安卓:线性布局新的生产线 [英] Android: Linear Layout new Line

查看:90
本文介绍了安卓:线性布局新的生产线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个类似的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中>
 

坦克!

修改

是这样的:

  1. textview1text的EditText textview2
  2. textview2continuesin2ndrow

不喜欢这样的:

  1. textview1text的EditText textview2text
  2. 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:

  1. textview1text edittext textview2
  2. textview2continuesin2ndrow

not like this:

  1. textview1text edittext textview2text
  2. 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>

这篇关于安卓:线性布局新的生产线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆