PrashantAdesara
PrashantAdesara

Reputation: 1917

Horizontal and vertical scrollbar in Android with tablelayout?

Please help me if you know how to add both scrollbar.
First of 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

Upvotes: 5

Views: 11212

Answers (3)

PrashantAdesara
PrashantAdesara

Reputation: 1917

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>

Upvotes: 1

sanjay
sanjay

Reputation: 2620

Use this code..

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

Upvotes: 2

anon
anon

Reputation:

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

Upvotes: -1

Related Questions