Hi am testing horizontal scrollview i came to a strange problem ,i put one button in horizontal scrollview with layout height and width fill_parent but that tag have no effect in layout ,lets look in to my layout
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:fillViewport="true"
>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
开发者_开发百科>
<Button
android:text="Button"
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</Button>
</LinearLayout>
</HorizontalScrollView>
How can i fill the layout with my button inside horizontal scrollview
the problem might be in android:width="wrap_content"
....
as u did wrap content for horizontal scrollview and it is parent of linearlayout and button in above case.......
that might be creating all the problem...
either hard code size of linear layout or put android:width="fill_parent"
in horizontal scroll view.....
Remember that scroll view layout_height must be warp_content , fill_parent attribute does not affect on the scrollview height, if you want to fill whole screen by button in your layout you should mentioned the layout_height hard coded.
Put this two tag in HorizontalScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
Put orientation in LinearLayout
android:orientation="vertical"
Do android:layout_height="fill_parent" to android:layout_height="wrap_content" in HorizontalScrollView
精彩评论