Tôi đang phát triển một ứng dụng Android.Căn chỉnh các nút trong TableRow
Tôi có điều này: nút
<?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="200px"
android:orientation="vertical">
<TextView
android:id="@+id/gameTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="left"
android:layout_margin="5px"
android:text="aaaaa"/>
<TextView
android:id="@+id/gameDescription"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="left"
android:layout_margin="5px"
android:typeface="sans"
android:textSize="16sp"
android:textStyle="bold"
android:text="dddddd"/>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ButtonsTable"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:text="@string/yes"
android:id="@+id/playGame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="@string/no"
android:id="@+id/noPlayGame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
</LinearLayout>
Tôi muốn đặt nút những môn chơi thể thao ở phía bên trái của trung tâm, và noPlayGame ở phía bên phải của trung tâm.
Bây giờ, cả hai xuất hiện được căn chỉnh bên trái của TableRow.
Tôi làm cách nào để thực hiện việc này?
Cảm ơn bạn.
EDIT: Tôi đã thêm bố cục hoàn chỉnh và các sửa đổi được đề xuất bởi Ashay.
2 EDIT:
CÁC GIẢI PHÁP
tôi đã thêm vào TableLayout
sau: android:stretchColumns="0,1"
. Bây giờ các nút được căn giữa nhưng chúng lấp đầy toàn bộ cột của chúng !!!
Có lẽ đáng để đăng câu trả lời của riêng bạn và đánh dấu câu trả lời là đã trả lời, để điều này không tiếp tục hiển thị trong danh sách câu hỏi chưa được trả lời. –
Tôi không thích trả lời các câu hỏi của mình. – VansFannel