Trong android, tôi có một khối mã:Làm cách nào để thêm nút động dưới chế độ xem khác?
// RelativeLayout with id is "root": main.xml
<EditText
android:id="@+id/pref_edit_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:hint="Text to share in preference"
/>
// This is the button I want to add to main.xml
<Button
android:id="@+id/save_button"
android:layout_below="@id/pref_edit_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save"
/>
Trong hoạt động của tôi, Với RelativeLayout.LayoutParam
tôi có thể thêm các button
ở vị trí left, right, top, bottom
của root
xem, nhưng tôi không thể thêm below
hoặc vv ... của một góc nhìn khác !! Vì vậy, Bất kỳ ai cũng có thể đưa ra đề xuất để thêm view
liên quan đến một view
khác trong RelativeLayout
động?
Cảm ơn, tôi sẽ thử !! –
@KingfisherPhuoc bạn có thể vui lòng hướng dẫn làm thế nào tôi có thể đặt các nút động đa cấp với vị trí ngẫu nhiên trong một bố trí tương đối –