开发者

Horizontal and vertical scrollbar in Android with tablelayout?

Please help me if you know how to add both scrollbar.

First 开发者_如何学Cof all i clear to all.

I added both scroll bar in tablelayout but main problem is i m using dynamic data for filling tablerow. So, if there is only one record so horizontal scroll view top after the data. but i want to show horizontal in bottom and also show vertical.

Thanks

Prashant


Use this code..

<ScrollView
android:id="@+id/scrllvwNo1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
//TextView
//Button
</ScrollView>
</LinearLayout> 


I tried this way and its run perfectly for me.

<ScrollView android:id="@+id/layout" android:layout_height="fill_parent"
    android:layout_alignParentBottom="true"
    android:scrollbars="horizontal|vertical" android:layout_width="fill_parent"
    android:layout_marginTop="50dip"
    android:scrollbarStyle="outsideInset">
<HorizontalScrollView android:id="@+id/horizontalView" android:layout_height="fill_parent"
    android:scrollbars="horizontal|vertical" android:layout_width="wrap_content"
    android:layout_marginTop="50dip">
    <RelativeLayout android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:id="@+id/RelativeLayout">

    <ImageView android:id="@+id/imgView" android:maxHeight="280dip"
            android:layout_marginLeft="20dip"   
            android:layout_marginTop="10dip"
            android:src="@drawable/ic_facebook" android:maxWidth="280dip"
            android:scaleType="centerInside"
            android:layout_height="280dip" 
            android:layout_width="280dip"></ImageView>
    </RelativeLayout>
</HorizontalScrollView>


Use the attribute scrollbarAlwaysDrawHorizontalTrack respectively scrollbarAlwaysDrawVerticalTrack

Here the documentation:

http://developer.android.com/reference/android/view/View.html#attr_android:scrollbarAlwaysDrawHorizontalTrack

http://developer.android.com/reference/android/view/View.html#attr_android:scrollbarAlwaysDrawVerticalTrack

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜