我有這樣的代碼它膨脹的觀點沒有保證金
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',它會引發異常。在這種情況下我將如何獲得利潤率? –
什麼是佈局? –