Tôi đang bắt đầu với Android. Tôi gặp khó khăn khi có một bố cục đơn giản đi.
Tôi muốn sử dụng một LinearLayout
vị trí hai TextViews
trong một hàng. Một TextView
ở phía bên tay trái, một ở phía bên phải (tương tự như float: left, float: right trong CSS).
Điều đó là có thể, hay tôi cần sử dụng một ViewGroup
cách bố trí khác hoặc sắp xếp lồng nhau để thực hiện nó?
Đây là những gì tôi có cho đến nay:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="horizontal" android:padding="10sp">
<TextView android:id="@+id/mytextview1" android:layout_height="wrap_content" android:text="somestringontheleftSomestring" android:layout_width="wrap_content"/>
<TextView android:id="@+id/mytextview2" android:layout_height="wrap_content" android:ellipsize="end"
android:text="somestringontheright" android:layout_width="wrap_content"/>
</LinearLayout>