内容在android中是非屏幕的

内容在android中是非屏幕的,android,android-layout,Android,Android Layout,我在线性布局中有3个元素需要在屏幕上显示,但目前没有 这是我想要的样子 TextView--TextView--EditText 但是,第二个文本视图相当长,它将编辑文本推离屏幕 所以它最终看起来像这样 TextView--(屏幕结束)|TextView--(屏幕结束)EditText 我环顾四周有一段时间了,似乎找不到一个简单的解决办法。如果这是一个重复的问题,请随时将我与相应的答案联系起来,因为我自己找不到它 这是代码,谢谢你的帮助 <ScrollView xmlns:android=

我在
线性布局中有3个元素需要在屏幕上显示,但目前没有

这是我想要的样子

TextView
--
TextView
--
EditText

但是,第二个
文本视图
相当长,它将
编辑文本
推离屏幕

所以它最终看起来像这样

TextView
--(屏幕结束)|
TextView
--(屏幕结束)
EditText

我环顾四周有一段时间了,似乎找不到一个简单的解决办法。如果这是一个重复的问题,请随时将我与相应的答案联系起来,因为我自己找不到它

这是代码,谢谢你的帮助

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="vertical" >

<LinearLayout
    android:id="@+id/iline_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:background="@color/white"
    android:gravity="center"
    android:orientation="vertical" >

<LinearLayout
        android:id="@+id/ll3"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:gravity="center"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/textView5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/b"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <TextView
            android:id="@+id/textView6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/distance_edge"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <EditText
            android:id="@+id/editText2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="4" />
</LinearLayout>
</LinearLayout>
</ScrollView>

尝试为文本视图设置权重属性并编辑文本。根据字符串是什么以及它们的包装方式,输出可能看起来有点笨拙

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

        <TextView
            android:id="@+id/textView5"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.33"
            android:text="Some string"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <TextView
            android:id="@+id/textView6"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.33"
            android:text="some really, really, really, long string"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <EditText
            android:id="@+id/editText2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.33"
            android:ems="4" />
    </LinearLayout>


现在它肯定是正确的-我已经在IDE中检查过了

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/iline_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="@color/white"
        android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/ll3"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:layout_gravity="center" >

        <TextView
            android:id="@+id/textView5"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="some long, long, long text"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <TextView
            android:id="@+id/textView6"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="some long, long, long, long, long, long, long, long, long text"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <EditText
            android:id="@+id/editText2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ems="4" />
    </LinearLayout>
    </LinearLayout>
</ScrollView>


对不起,它不起作用。完全相同的问题,中间的一个扩展并将另外两个从屏幕上推下,但它只做了一次换行。它还指责我使用嵌套权重,说“这对性能有害”。你看到我的示例在封闭的LinearLayout中没有权重属性了吗?如果有任何方法可以在封闭的线性布局上方使用其他线性布局以外的其他布局,那么就警告而言,您将处于良好状态。对我来说很好。嘿,韩恩!很高兴再次见到您,不幸的是,您的解决方案也不起作用。它实际上使整个版面从我的屏幕上消失。这个版面是更大版面的一部分吗?我编辑了答案,剪切粘贴,忘记了制作版面,是的,完整的代码太长,无法发布。它是嵌套在另一个线性布局中的第三个线性布局,嵌套在滚动视图中。在这个片段中总共有超过25个线性布局。我刚刚再次编辑了答案,希望这次能成功。不,但是我编辑了我的帖子,因为我认为在这个片段之外的布局有问题。复制并粘贴我的代码。在我的IDE中,一切都可以根据需要工作。是的,它会。但你错过了一个非常关键的一点。第二根弦的长度是我的第二根弦的五分之一。试着放5倍于你所说时间的东西,它会起作用的,谢谢。对不起,我在这件事上浪费了这么多时间,简直让我发疯了。现在我只需要调整第一个宽度到我想要的,因为它太长了。所以我猜设置布局权重是把事情搞砸的原因?在TV1、TV2和ET上设置
android\u height
参数以
match\u parent
。您看到@mmBs字符串的最底部是如何被切断的了吗?文字在那里占了一半。我该如何解决这个问题?
<LinearLayout
    android:id="@+id/ll3"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:weightSum="3"
    android:gravity="center"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/textView5"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/b"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/textView6"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/distance_edge"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <EditText
        android:id="@+id/editText2"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:ems="4" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/iline_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="@color/white"
        android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/ll3"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:layout_gravity="center" >

        <TextView
            android:id="@+id/textView5"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="some long, long, long text"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <TextView
            android:id="@+id/textView6"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="some long, long, long, long, long, long, long, long, long text"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <EditText
            android:id="@+id/editText2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ems="4" />
    </LinearLayout>
    </LinearLayout>
</ScrollView>