我的佈局,我想誇大這打氣筒充氣,但高度小(貌似WRAP_CONTENT和需要FILL_PARENT)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<EditText
android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</EditText>
</LinearLayout>
像
LinearLayout ll=(LinearLayout)findViewById(R.id.llContainer);
View view;
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.question_free_text, null);
ll.addView(view);
其中,LL爲
<LinearLayout
android:id="@+id/llContainer"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
>
</LinearLayout>
在其他XML中,但問題是當它膨脹它顯示,但高度很大(fill_parent,它看起來像wrap_content,但沒有wrap_content佈局)。有誰能夠幫助我 ?
可能是因爲這些2tags的..機器人:layout_marginTop =「20dp」 機器人: layout_marginBottom =「20dp」 – ngesh
在膨脹期間用父視圖替換null。 –