Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.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 自动减少文本视图宽度_Android_Android Layout - Fatal编程技术网

Android 自动减少文本视图宽度

Android 自动减少文本视图宽度,android,android-layout,Android,Android Layout,这是我的布局代码。以及它的外观截图 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="top" android:ba

这是我的布局代码。以及它的外观截图

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="top"
    android:background="@android:color/white">

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="#fac14b">

        <TextView
            android:id="@+id/BackAction_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="8dp"
            android:textColor="#33AAFF"
            android:textSize="16dp"
            android:textStyle="normal"
            android:gravity="center"
            android:drawableLeft="@drawable/back_arrow"/>

        <TextView
            android:id="@+id/ActiveFrameCaption_txt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:textColor="#000000"
            android:textSize="18dp"
            android:textStyle="normal"/>
    </RelativeLayout>

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/main_activity_frame_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>

正如你们所看到的,我在RelativeLayout上有两个文本视图的顶部面板


现在,当右文本视图太大时,它会显示在左文本视图上。所以我的问题是:如果右文本视图太大,是否可以自动减小左文本视图的宽度?

是否从Java向这些文本视图添加文本?是否尝试将toRightOf属性添加到右文本视图?1) 是的,我正在添加来自java代码的文本2)如果我使用toRightOf i lost alignment设置