我忙於使用其中包含單個文本視圖的水平滾動視圖。 我無法讓textview能夠從一側滑動到另一側而沒有任何空間。帶有單個滑動文本的HorizontalScrollView
如果我只是添加textview,它無法滑動。
基本上所有我想要的是在中心一個TextView水平滾動視圖那可以滾動左或右,但沒有反彈時(仍然可見)
eg: | Text | |Text | | Text| But not |ext | | Te|
我目前的佈局是這樣的:
<HorizontalScrollView
android:layout_width="250dp"
android:layout_height="35dp"
android:scrollbars="none" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="36dp" >
<Space
android:layout_width="125dp"
android:layout_height="wrap_content"
android:background="#808080" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEST"
android:textSize="30dp" />
<Space
android:layout_width="125dp"
android:layout_height="wrap_content"
android:background="#808080" />
</LinearLayout>
</HorizontalScrollView>
噢,如果我刪除空間的觀點,然後我的TextView不能滾動 – user1838169 2013-02-11 13:49:07
我不得不承認林不知道你正在嘗試做的是scrollview的預期目的。滾動視圖的目的是讓您滾動顯示比物理屏幕空間大的內容。只有一個單詞的文本視圖不會大於屏幕的物理空間。你可以嘗試將你的textview寬度設置爲280,並設置居中文本的屬性。這樣你至少沒有2個空格。儘管如此,你仍然在做同樣的事情。 – trumpetlicks 2013-02-11 13:52:31
認爲我這樣做是錯誤的,但請任何意見將有所幫助,基本上我希望文本出現在中間,然後用戶可以將其滑動到一側或另一側。水平滾動視圖是否使用了錯誤的視圖? – user1838169 2013-02-11 13:55:46