[英]Android:HorizontalScrollView wrap its child?
I have HorizontalScrollView with RelativeLayout as a child. 我有一个带有RelativeLayout的HorizontalScrollView作为孩子。 And here is my xml file:
这是我的xml文件:
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff00ff"
android:scrollbars="none">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff" >
</RelativeLayout>
</HorizontalScrollView>
The output is pink color...But I need white...Why Relative Layout didn't filled its parent ? 输出为粉色...但是我需要白色...为什么相对布局未填充其父级?
screenshot: 屏幕截图:
screenshot with buttons: 带有按钮的屏幕截图:
As you can see when you put the buttons in you are not matching the scrollview. 正如您看到的那样,当您放入按钮时,您与滚动视图不匹配。 try using a
LinearLayout
as your parent then have the scrollview as a child with match_parent
and then add in your other layout as a child of the scrollview the match_parent
also 尝试使用
LinearLayout
作为父项,然后将scrollview作为具有match_parent
的子项,然后将其他布局作为scrollview的子项添加match_parent
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.