Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/202.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 Relativelayout - Fatal编程技术网

Android 相对布局重叠

Android 相对布局重叠,android,android-relativelayout,Android,Android Relativelayout,大家都很高兴 我正在开发一个简单的定制ArrayAdapter,突然遇到了一个重叠的问题 这是我的布局的xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wra

大家都很高兴

我正在开发一个简单的定制ArrayAdapter,突然遇到了一个重叠的问题

这是我的布局的xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:text="@+id/label" />

    <EditText
        android:id="@+id/editText"
        android:hint="0"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_marginLeft="4dp"
        android:layout_marginRight="10dp">
    </EditText>

</RelativeLayout>

问题是,如果标签太长,它会与edittext元素重叠

我也尝试过使用带有权重的水平布局,但是当标签太长时,edittext会从屏幕上消失


我读过6篇关于相对布局重叠的帖子,但似乎没有任何效果。

将android:layout\u toRightOf=“@id/label”添加到编辑文本中。这将使其始终显示在标签的右侧

设置固定宽度而不是包裹内容,但如何使值随屏幕大小而变化?您为什么要担心屏幕大小?您使用的是“dp(密度独立像素)”,其名称本身表明该值将在屏幕大小上更改。。如果您对此有任何疑问,请参阅此选项。文本过长时,此选项会重叠