我有一个布局是这样的:添加布局滚动型被吃掉了
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:background="#ff303f"
android:id="@+id/layout">
<ImageView
android:id="@+id/picture"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_centerInParent="true"/>
<Button
android:id="@+id/cancel"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_alignRight="@id/picture"
android:background="@drawable/cross_out"/>
</RelativeLayout>
我使用正常的布局充气服务它充气,设置一些功能按钮和图像的ImageView的(所有图像的大小和宽高比都相同)。
在那之后,我加入这个观点我片段的布局,也不过是滚动型这是一个家长,它有一个我称之为“地图”,并简单地把它添加到地图一个孩子的线性布局。
预期:添加的布局应该正确添加,并且可以滚动浏览它。 实际:如果添加了2个以上,第一个会被吃掉。我可以看到它一半或有时它完全吃掉了。 :\
任何想法这是怎么回事?非常感谢您的时间。
编辑: 这里的布局文件I添加膨胀布局成:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f6ff45">
<LinearLayout
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#43ff44"
android:orientation="vertical"
android:layout_margin="10dp"
android:layout_gravity="center"
android:layout_marginTop="15dp">
</LinearLayout>
</ScrollView>
我还忘了提及,添加3个或更多这些布局后,我意识到有一个在端不必要空的空间。 :\
是您正在使用的垂直或水平滚动视图的子项的LinearLayout? – Blackbelt 2014-10-01 14:52:30
请发布您的ScrollView的XML细节 – 2014-10-01 14:54:20
我已经发布了主布局文件,请查看它。谢谢! – 2014-10-01 15:23:31