我们如何ScrollView纵向和横向设置?我尝试了下面的代码,但它没有用.
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/red"
android:scrollbarFadeDuration="1000"
android:scrollbarSize="12dip" >
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:collapseColumns="2"
android:stretchColumns="1" >
</TableLayout>
</HorizontalScrollView>
<ScrollView >
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
这是我的所有代码:http://pastebin.com/ysRhLMyt
当前屏幕:

我想总是显示滚动条.
尝试,
设置 android:scrollbarFadeDuration="0"
OR
Run Code Online (Sandbox Code Playgroud)ScrollView1.setScrollbarFadingEnabled(false);
OR
Run Code Online (Sandbox Code Playgroud)android:scrollbarFadeDuration="0"和
android:scrollbarAlwaysDrawVerticalTrack="true" 垂直
android:scrollbarAlwaysDrawHorizontalTrack="true" 表示水平
还有一件事情,
请记住,ScrollView 只能有一个子控件,因此我们可以将一个容器(线性、相对、表布局)作为 ScrollView 的子控件,并将所有控件放入该子控件中。
供参考: http: //android-pro.blogspot.com/2010/02/android-scrollview.html
| 归档时间: |
|
| 查看次数: |
17577 次 |
| 最近记录: |