Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/188.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何制作TextView';在一行中左边有两个文本视图?_Android_Android Linearlayout_Textview_Gravity_Layout Gravity - Fatal编程技术网

Android 如何制作TextView';在一行中左边有两个文本视图?

Android 如何制作TextView';在一行中左边有两个文本视图?,android,android-linearlayout,textview,gravity,layout-gravity,Android,Android Linearlayout,Textview,Gravity,Layout Gravity,我想使用LinearLayout将两个TextView的文本放置在一行的左侧。一个文本视图位于左侧,另一个位于右侧。整行文本将与垂直文本位于同一行。以下是我的XML: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.co

我想使用LinearLayout将两个TextView的文本放置在一行的左侧。一个文本视图位于左侧,另一个位于右侧。整行文本将与垂直文本位于同一行。以下是我的XML:

   <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="top|center"
    android:orientation="vertical"
    tools:context=".Butcegiris" >

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:ignore="UselessParent" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:background="@android:color/background_light"
            android:orientation="vertical" >

            <LinearLayout
                android:id="@+id/tableRow1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/textButtonBakici"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="@string/textBakici" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="left"
                    android:layout_weight="1"
                    android:gravity="left"
                    android:orientation="horizontal" >

                <TextView
                    android:id="@+id/textButtonBakici2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/textBakici" />
                </LinearLayout>

            </LinearLayout>

            <LinearLayout
                android:id="@+id/tableRow2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/textKrediAraba"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="@string/textKrediAraba" />

                 <LinearLayout
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_gravity="left"
                     android:layout_weight="1"
                     android:gravity="left"
                     android:orientation="horizontal" >

                <TextView
                    android:id="@+id/textKrediAraba2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/textKrediAraba" />
                </LinearLayout>
            </LinearLayout>

以及它的观点


垂直方向上,数字将位于同一行。非常感谢你的帮助……

我想你应该看看这门课。看起来应该好多了


当然,如果你认为会有很多条目,考虑每个字段使用一个固定宽度的A。

你的LayuSug权重元素应该有LayOutSuffeleStand设置为MatHelPrime:< /P>

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="top|center"
    android:orientation="vertical"
    tools:context=".Butcegiris" >

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:ignore="UselessParent" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:background="@android:color/background_light"
            android:orientation="vertical" >

        <LinearLayout
            android:id="@+id/tableRow1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/textButtonBakici"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/textBakici" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="left"
                android:layout_weight="1"
                android:gravity="left"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/textButtonBakici2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/textBakici" />
                </LinearLayout>        
            </LinearLayout>

            <LinearLayout
                android:id="@+id/tableRow2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/textKrediAraba"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="@string/textKrediAraba" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="left"
                        android:layout_weight="1"
                        android:gravity="left"
                        android:orientation="horizontal" >

                    <TextView
                        android:id="@+id/textKrediAraba2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/textKrediAraba" />
                </LinearLayout>
            </LinearLayout>

正确的大小写和空间使用,+1。