开发者

Scrollview horizontal and vertical doesnt work at the same time

Does anybody tell me how do I make Scroll开发者_JS百科View if I want to use vertical and horizontal at the same time?


look here, there is somebody who coded a solution for your problem. nothing trivial but a handy solution, i think.

Scrollview vertical and horizontal in android


You can use both scroll view in this way it works for me

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
> 
<HorizontalScrollView 
android:orientation="horizontal"        
android:layout_width="match_parent" 
android:layout_height="match_parent" 
> 
<TableLayout 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 
<TableRow android:id="@+id/first"
android:layout_width="fill_parent" 
android:layout_height="fill_parent" >
<Button android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="back"></Button>

</TableRow>

 <TableRow android:id="@+id/second"
android:layout_width="fill_parent" 
android:layout_height="fill_parent" >

<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="Hole
No./Pic"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="Distance"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="Par"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="Stroke"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="Player-1"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="Player-2"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="Player-3"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="Player-4"></TextView>

</TableRow>

<TableRow android:id="@+id/third"
android:layout_width="fill_parent" 
android:layout_height="fill_parent" >
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="1" android:textSize="24dp"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="222yrds" android:textSize="24dp"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="1" android:textSize="24dp"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="1" android:textSize="24dp"></TextView>

<EditText android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="       "
android:id="@+id/playra1"></EditText>
 <EditText android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="       "
android:id="@+id/playrb1"></EditText>
<EditText android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="       "
android:id="@+id/playrc1"></EditText>
<EditText android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="       "
android:id="@+id/playrd1"></EditText>     
</TableRow>

<TableRow android:id="@+id/third"
android:layout_width="fill_parent" 
android:layout_height="fill_parent" >
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="2"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="1" android:textSize="24dp"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="1" android:textSize="24dp"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="1" android:textSize="24dp"></TextView>

<EditText android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="       "
android:id="@+id/playra2"></EditText>
 <EditText android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="       "
android:id="@+id/playrb2"></EditText>
<EditText android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="       "
android:id="@+id/playrc2"></EditText>
<EditText android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="       "
android:id="@+id/playrd2"></EditText>     
</TableRow>

<TableRow android:id="@+id/third"
android:layout_width="fill_parent" 
android:layout_height="fill_parent" >
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="2"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="1" android:textSize="24dp"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="1" android:textSize="24dp"></TextView>
<TextView android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="1" android:textSize="24dp"></TextView>

<EditText android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="       "
android:id="@+id/playra3"></EditText>
 <EditText android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="       "
android:id="@+id/playrb3"></EditText>
<EditText android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="       "
android:id="@+id/playrc3"></EditText>
<EditText android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="       "
android:id="@+id/playrd3"></EditText>     
</TableRow>



</TableLayout> 

</HorizontalScrollView>

</ScrollView>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜