Use ScrollView & HorizontalScrollView in TableLayout
How can I setup ScrollView
vertically & horizontally? I tried with the code below, but it didn't work.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/androi开发者_如何学Pythond"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbarFadeDuration="1000"
android:scrollbarSize="12dip"
android:background="@color/red" >
<HorizontalScrollView android:id="@+id/horizontalScrollView1" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TableLayout android:layout_width="match_parent" android:layout_marginTop="10dp" android:id="@+id/tableLayout1" android:layout_height="wrap_content" android:stretchColumns="1" android:collapseColumns="2">
</TableLayout>
</HorizontalScrollView>
</ScrollView>
Here is my all code: http://pastebin.com/ysRhLMyt
Try,
Set the android:scrollbarFadeDuration="0"
OR
ScrollView1.setScrollbarFadingEnabled(false);
OR
android:scrollbarFadeDuration="0" and
android:scrollbarAlwaysDrawVerticalTrack="true" for vertical
android:scrollbarAlwaysDrawHorizontalTrack="true" for horizontal
And one more thing,
Remember, the ScrollView can have only one child control, so we can make a container (Linear, relative, Table Layouts) the child of the ScrollView and put all the controls inside this child.
For reference: http://android-pro.blogspot.com/2010/02/android-scrollview.html
TableLayout ScrollView Vertical & Horizontal
Try changing the height of the ScrollView
to "fill_parent"
.
If it is the rows you want to move horizontally, then i suggest designing your layout like
Scrollview as parent , table layout as its only child, and then add the table rows to the table layout , put the horizontalscrollview inside each table row. This way you can move the table vertically and the rows in the table horizontally.
hope this helps.
The Linear layout (@+id/linearLayout3) orientation is horizontal, make it vertical so that the content is shown below. I think presently, your list divider and list items are added horizontally on the screen, instead vertically.
精彩评论