-1
我有一個框架佈局,包含一個edittext和按鈕(用於刪除字段),當用戶單擊按鈕時,我想多次添加到相對佈局。多次添加預定義的framelayout到相對佈局
我已經搜查,但我只是無法找到如何以編程方式做到這一點。
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" >
<EditText
android:id="@+id/inputbox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textSize="25sp"
android:textStyle="bold"
android:hint="@string/inputhint"
android:ems="10"
android:imeOptions="actionNext"
android:singleLine="true" />
<Button
android:id="@+id/buttonremove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_gravity="right|center_vertical"
android:background="@drawable/remove" />
</FrameLayout>
您希望生成的佈局看起來如何?垂直行中的所有FrameLayouts? – brillenheini
是的。所以會有一排垂直的文字輸入。在使用此框架佈局動態創建的前後有兩個非動態輸入 – QazPhilby