安卓:线性布局新的生产线线性、生产线、布局

2023-09-07 03:50:30 作者:上仙

我创建了一个类似的LinearLayout下面的TextView。该文本是可变的。如果这些元素变得大于布局宽度它变得肮脏。我想有文本流到新行只是一个会写一本书的时候做的。这可能吗?

 <的LinearLayout
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT>

<的TextView
            机器人:ID =@ + ID / textView1
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:文本=XX
            机器人:textAppearance =:/>中的Andr​​oid ATTR / textAppearanceSmall?

< EditText上...>

<的TextView
            机器人:ID =@ + ID / textView2
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:文本=XX
            机器人:textAppearance =:/>中的Andr​​oid ATTR / textAppearanceSmall?
< / LinearLayout中>
 

坦克!

修改

是这样的:

textview1text的EditText textview2 textview2continuesin2ndrow

不喜欢这样的:

textview1text的EditText textview2text textview1cont 解决方案

尝试像...

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT>
    <的LinearLayout
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =FILL_PARENT>
        <的TextView
            机器人:ID =@ + ID / textView1
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:文本=XX
            机器人:textAppearance =:/>中的Andr​​oid ATTR / textAppearanceSmall?
        < EditText上...>
    < / LinearLayout中>
    <的LinearLayout
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =FILL_PARENT
        机器人:方向=垂直>
        <的TextView
            机器人:ID =@ + ID / textView2
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =FILL_PARENT
            机器人:文本=XX
            机器人:textAppearance =:/>中的Andr​​oid ATTR / textAppearanceSmall?
    < / LinearLayout中>
< / LinearLayout中>
 

机加设备生产线规划布局模型

I created a LinearLayout like below with TextView. The Text is variable. If the Elements gets bigger than the Layout width it gets nasty. I want to have the text flow to a new line just one would do when writing a book. Is this possible?

<LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

<TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="xx"
            android:textAppearance="?android:attr/textAppearanceSmall" />

<EditText ...>

<TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="xx"
            android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>

Tanks!

edit

like this:

textview1text edittext textview2 textview2continuesin2ndrow

not like this:

textview1text edittext textview2text textview1cont

解决方案

Try something like...

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" >
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="xx"
            android:textAppearance="?android:attr/textAppearanceSmall" />
        <EditText ...>
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:text="xx"
            android:textAppearance="?android:attr/textAppearanceSmall" />
    </LinearLayout>
</LinearLayout>