我有这样的代码它膨胀的观点没有保证金
View item = View.inflate(context, R.layout.item_layout, null);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT);
layout.addView(item, params);
我item_layout:(注意部分的android:layout_marginTop = “2DIP”)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_marginTop="2dip" android:layout_width="fill_parent">
<ImageView android:src="@drawable/pic_unknown" android:id="@+id/image1"
android:layout_height="50dip" android:layout_width="50dip"
android:padding="5dip"></ImageView>
</RelativeLayout>
,然后在我的布局我见在他们之间膨胀但没有余量的物品清单。我尝试了与margintop = 10dip仍然没有发生我的观点是,我把它放在布局中的价值没有采取带有或没有边缘的计算顶部布局是相同的。
如何在项目之间添加一些空白空间? 如何给项目之间的空间充气? 是否有可能膨胀东西像差距或一些空间? 或我必须使用替代方法,如使用2dip高度或某物的某种空白布局充气 感谢
很好的建议。它是attachToRoot。 –
我的问题是我膨胀一个'View'将它附加到'ListView'作为标题;如果我在inflater中使用'ListView',它会引发异常。在这种情况下我将如何获得利润率? –
什么是布局? –