gpt4 book ai didi

android - 无法在 Android 应用程序中对齐复选框(水平/垂直)

转载 作者:行者123 更新时间:2023-11-30 03:43:25 24 4
gpt4 key购买 nike

我需要显示复选框。所有的复选框都应该在屏幕的最右边对齐。但是,如果我改变屏幕的方向,复选框就会出现在屏幕的中间。请帮我解决这个问题。提前致谢

<?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"
android:background="#000000"
>




<LinearLayout android:id="@+id/LinearLayout02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:orientation="vertical"
android:layout_margin="10dp">




<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000"
>


<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sf_table"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="50dp"
android:background="@drawable/test"

>

<View android:id="@+id/Divider_7"
android:layout_height="0.5dp"
android:layout_width="fill_parent"
android:background="#808080"

android:layout_marginBottom="5dp"
/>
<TableRow
android:id="@+id/tbr6"

android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_margin="2dip"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
>

<TextView
android:textStyle="bold"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:textColor="#3399CC"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Pages For Website (existing pages plus new ones you need)-Contact Us"
></TextView>

</TableRow>

<View android:id="@+id/Divider_2"
android:layout_height="1.5dp"
android:layout_width="fill_parent"
android:background="#C0C0C0"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
/>
<TableRow
android:id="@+id/tbr9"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_margin="2dip"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
>


<TextView
android:textStyle="bold"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:textColor="#ffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Feedback"
></TextView>

<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/feedback_id"
android:layout_gravity="right"
></CheckBox>


</TableRow>



<TableRow
android:id="@+id/tbr9"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_margin="2dip"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
>


<TextView
android:textStyle="bold"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:textColor="#ffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Tech Support"
></TextView>

<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/techsupport_id"
android:layout_gravity="right"
></CheckBox>


</TableRow>


<TableRow
android:id="@+id/tbr9"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_margin="2dip"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
>


<TextView
android:textStyle="bold"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:textColor="#ffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Quote Form"
></TextView>

<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/quoteform_id"
android:layout_gravity="right"
></CheckBox>


</TableRow>

</TableLayout>





</RelativeLayout>

</ScrollView>


</LinearLayout>

最佳答案

尝试以下操作

android:layout_gravity="right"
android:gravity="right"

关于android - 无法在 Android 应用程序中对齐复选框(水平/垂直),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15403417/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com