0
當我在設備上放大字體時,發生此問題,之後我不再在我的文本視圖中看到垂直滾動條。當我將字體大小更改爲小時,滾動條出現。下面是我的XML佈局看起來怎麼樣:更改Android手機上的字體大小後,在textView內啓用滾動條
<ScrollView android:id="@+id/MyScrollView" android:layout_height="150px" android:layout_width="fill_parent"> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:text="xxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasdxxasdasdasd." android:textSize="24sp" android:layout_margin="20dp" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:maxLines = "20" android:gravity="bottom" android:scrollbars="vertical" android:scrollbarStyle="insideOverlay" android:textColor="#676767" /> <TextView android:id="@+id/tv_link" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/tv_title" android:layout_centerHorizontal="true" android:layout_margin="5dp" android:padding="5dp" android:textSize="24sp" android:text="Enroll Now" android:textColor="#FF0C7CC0" /> </ScrollView>
代碼工作正常,但只要我改變了字體大小設備上的滾動條消失
這裏是我我Activity類裏面做:
ScrollView scroller = (ScrollView) findViewById(R.id.ScrollView01); TextView tv = (TextView) findViewById(R.id.title); tv.setMovementMethod(new ScrollingMovementMethod());
如你所說......仍然沒有工作:( –
嘗試刪除滾動條的風格一樣,也有沒有tv_title,這是標題更正 – Aakash