Android的TextView的文字不是2.3.3版本中的RelativeLayout包装 [英] Android TextView text not wrapping within RelativeLayout on version 2.3.3
问题描述
我一直在试图让一个TextView包文在Android 2.3.3多行一段时间没有,但我不能缝得到它的工作,甚至在最基本的水平。无论我做什么文字总是在屏幕的边缘,只是切断。它的工作原理就好在Android 4,但我想针对2.3.3为好。
我曾尝试只是基本的部分在这里:
<?XML版本=1.0编码=UTF-8&GT?;
<的LinearLayout
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =match_parent> <的TextView
机器人:ID =@ + ID / mainDescText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_weight =1
机器人:文字=@字符串/ A_MORE_DESCRIPTION_TEXT/>
< / LinearLayout中>
但是,这仍然不换行。我说我试图得到这个工作,真实的布局是在这里:
<?XML版本=1.0编码=UTF-8&GT?;
<滚动型
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =match_parent> <的LinearLayout
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:方向=垂直> < RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =55dp> <的TextView
机器人:ID =@ + ID / mainDescText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:行=2
机器人:文字=@字符串/ A_MORE_DESCRIPTION_TEXT/>
< / RelativeLayout的> < RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =80dp> <的TextView
机器人:ID =@ + ID / ageCurrentText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_above =@ + ID / ageButton
机器人:layout_alignParentLeft =真
机器人:layout_alignParentRight =真
机器人:文字=@字符串/ A_MORE_CURRENT_SIGHTINGS_AGE/> <按钮
机器人:ID =@ + ID / ageButton
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentBottom =真
机器人:layout_alignParentLeft =真
机器人:layout_alignParentRight =真
安卓的onClick =loadSightingsAge
机器人:文字=@字符串/ A_MORE_SIGHTINGS_AGE_BUTTON/>
< / RelativeLayout的> < RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =80dp
机器人:layout_marginTop =10dp> <的TextView
机器人:ID =@ + ID / languageCurrentText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_above =@ + ID / languageButton
机器人:layout_alignParentLeft =真
机器人:layout_alignParentRight =真
机器人:文字=@字符串/ A_MORE_CURRENT_LANGUAGE/> <按钮
机器人:ID =@ + ID / languageButton
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentBottom =真
机器人:layout_alignParentLeft =真
机器人:layout_alignParentRight =真
安卓的onClick =loadLanguage
机器人:文字=@字符串/ A_MORE_LANGUAGE_BUTTON/>
< / RelativeLayout的> < RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =50dp
机器人:layout_marginTop =10dp> < ImageView的
机器人:ID =@ + ID / redPinImage
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@绘制/ red_pin
机器人:contentDescription =@字符串/ A_MORE_RED_PIN_IMAGE/> <的TextView
机器人:ID =@ + ID / redPinText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentRight =真
机器人:layout_marginLeft =10dp
机器人:layout_toRightOf =@ + ID / redPinImage
机器人:文字=@字符串/ A_MORE_RED_PIN_DESCRIPTION/> < / RelativeLayout的> < RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =50dp
机器人:layout_marginTop =10dp> < ImageView的
机器人:ID =@ + ID / yellowPinImage
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@绘制/ yellow_pin
机器人:contentDescription =@字符串/ A_MORE_YELLOW_PIN_IMAGE/> <的TextView
机器人:ID =@ + ID / yellowPinText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentRight =真
机器人:layout_marginLeft =10dp
机器人:layout_toRightOf =@ + ID / yellowPinImage
机器人:文字=@字符串/ A_MORE_YELLOW_PIN_DESCRIPTION/> < / RelativeLayout的> < RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =50dp
机器人:layout_marginTop =10dp> < ImageView的
机器人:ID =@ + ID / greenPinImage
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@绘制/ green_pin
机器人:contentDescription =@字符串/ A_MORE_GREEN_PIN_IMAGE/> <的TextView
机器人:ID =@ + ID / greenPinText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentRight =真
机器人:layout_marginLeft =10dp
机器人:layout_toRightOf =@ + ID / greenPinImage
机器人:文字=@字符串/ A_MORE_GREEN_PIN_DESCRIPTION/> < / RelativeLayout的> < RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =50dp
机器人:layout_marginTop =10dp>
<的TextView
机器人:ID =@ + ID / thanksText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentRight =真
机器人:文字=@字符串/ A_MORE_CREATED_BY_TEXT/> < / RelativeLayout的> < / LinearLayout中>
< /滚动型>
编辑:
我不记得正是我改变,但我能得到它与该XML的工作:
<?XML版本=1.0编码=UTF-8&GT?;
<滚动型
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =match_parent> <的LinearLayout
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:方向=垂直> <的LinearLayout
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =55dp> <的TextView
机器人:ID =@ + ID / mainDescText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:比重=中心
机器人:行=3
机器人:scrollHorizontally =假
机器人:文字=@字符串/ A_MORE_DESCRIPTION_TEXT/>
< / LinearLayout中> < RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =80dp> <的TextView
机器人:ID =@ + ID / ageCurrentText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_above =@ + ID / ageButton
机器人:layout_alignParentLeft =真
机器人:layout_alignParentRight =真
机器人:比重=中心
机器人:文字=@字符串/ A_MORE_CURRENT_SIGHTINGS_AGE/> <按钮
机器人:ID =@ + ID / ageButton
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentBottom =真
机器人:layout_alignParentLeft =真
机器人:layout_alignParentRight =真
安卓的onClick =loadSightingsAge
机器人:文字=@字符串/ A_MORE_SIGHTINGS_AGE_BUTTON/>
< / RelativeLayout的> < RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =80dp
机器人:layout_marginTop =10dp> <的TextView
机器人:ID =@ + ID / languageCurrentText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_above =@ + ID / languageButton
机器人:layout_alignParentLeft =真
机器人:layout_alignParentRight =真
机器人:比重=中心
机器人:文字=@字符串/ A_MORE_CURRENT_LANGUAGE/> <按钮
机器人:ID =@ + ID / languageButton
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentBottom =真
机器人:layout_alignParentLeft =真
机器人:layout_alignParentRight =真
安卓的onClick =loadLanguage
机器人:文字=@字符串/ A_MORE_LANGUAGE_BUTTON/>
< / RelativeLayout的> < RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =50dp
机器人:layout_marginTop =10dp> < ImageView的
机器人:ID =@ + ID / redPinImage
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@绘制/ red_pin
机器人:contentDescription =@字符串/ A_MORE_RED_PIN_IMAGE/> <的TextView
机器人:ID =@ + ID / redPinText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentRight =真
机器人:layout_marginLeft =10dp
机器人:layout_toRightOf =@ + ID / redPinImage
机器人:行=3
机器人:scrollHorizontally =假
机器人:文字=@字符串/ A_MORE_RED_PIN_DESCRIPTION/> < / RelativeLayout的> < RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =50dp
机器人:layout_marginTop =10dp> < ImageView的
机器人:ID =@ + ID / yellowPinImage
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@绘制/ yellow_pin
机器人:contentDescription =@字符串/ A_MORE_YELLOW_PIN_IMAGE/> <的TextView
机器人:ID =@ + ID / yellowPinText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentRight =真
机器人:layout_marginLeft =10dp
机器人:layout_toRightOf =@ + ID / yellowPinImage
机器人:行=3
机器人:scrollHorizontally =假
机器人:文字=@字符串/ A_MORE_YELLOW_PIN_DESCRIPTION/> < / RelativeLayout的> < RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =50dp
机器人:layout_marginTop =10dp> < ImageView的
机器人:ID =@ + ID / greenPinImage
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@绘制/ green_pin
机器人:contentDescription =@字符串/ A_MORE_GREEN_PIN_IMAGE/> <的TextView
机器人:ID =@ + ID / greenPinText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentRight =真
机器人:layout_marginLeft =10dp
机器人:layout_toRightOf =@ + ID / greenPinImage
机器人:行=3
机器人:scrollHorizontally =假
机器人:文字=@字符串/ A_MORE_GREEN_PIN_DESCRIPTION/> < / RelativeLayout的> < RelativeLayout的
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =50dp
机器人:layout_marginTop =10dp>
<的TextView
机器人:ID =@ + ID / thanksText
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentRight =真
机器人:比重=中心
机器人:行=3
机器人:scrollHorizontally =假
机器人:文字=@字符串/ A_MORE_CREATED_BY_TEXT/> < / RelativeLayout的> < / LinearLayout中>
< /滚动型>
我有同样的确切问题。我只想说,我最近刚刚从采用的是Android 2.3.3平台最多的Android 4.0.3平台,因为我想借此河洛主题的优势改变。所以,我的默认主题看起来是这样的。
<样式名称=mytheme的父=机器人:Theme.Holo>
<项目名称=机器人:windowNoTitle>真< /项目>
< /风格>
我所有的textViews运行看我的手机上出色的Android 4.0.3
但是,当我跑我的应用程序在运行Android 2.3.3无包裹textViews的模拟器。我用Google搜索和Google搜索和pretty很多尝试的每个组合:
的android:inputType下=textMultiLine
机器人:scrollHorizontally =假
机器人:ellipsize =无
机器人:layout_weight =1
纳达。于是我决定再向我原来的主题:
<样式名称=MyApp的父=机器人:Theme.Black.NoTitleBar/>
中提琴! TextViews又开始包装。去搞清楚。不是一个真正的解决方案,但也许别人可以解释为什么。一些光
I have been trying to get a TextView to wrap the text to multiple lines on Android 2.3.3 for a while not but I can't seam to get it working, even on the most basic of levels. No matter what I do the text always just cuts off at the edge of the screen. It works just fine on Android 4 but I would like to target 2.3.3 as well.
I have tried just the basic part here:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/mainDescText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/A_MORE_DESCRIPTION_TEXT" />
</LinearLayout>
But that still doesn't wrap the text. My real layout that I am trying to get this to work on is here:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="55dp" >
<TextView
android:id="@+id/mainDescText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="2"
android:text="@string/A_MORE_DESCRIPTION_TEXT" />
</RelativeLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="80dp" >
<TextView
android:id="@+id/ageCurrentText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/ageButton"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:text="@string/A_MORE_CURRENT_SIGHTINGS_AGE" />
<Button
android:id="@+id/ageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:onClick="loadSightingsAge"
android:text="@string/A_MORE_SIGHTINGS_AGE_BUTTON" />
</RelativeLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:layout_marginTop="10dp" >
<TextView
android:id="@+id/languageCurrentText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/languageButton"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:text="@string/A_MORE_CURRENT_LANGUAGE" />
<Button
android:id="@+id/languageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:onClick="loadLanguage"
android:text="@string/A_MORE_LANGUAGE_BUTTON" />
</RelativeLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp" >
<ImageView
android:id="@+id/redPinImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/red_pin"
android:contentDescription="@string/A_MORE_RED_PIN_IMAGE" />
<TextView
android:id="@+id/redPinText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/redPinImage"
android:text="@string/A_MORE_RED_PIN_DESCRIPTION" />
</RelativeLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp" >
<ImageView
android:id="@+id/yellowPinImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/yellow_pin"
android:contentDescription="@string/A_MORE_YELLOW_PIN_IMAGE" />
<TextView
android:id="@+id/yellowPinText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/yellowPinImage"
android:text="@string/A_MORE_YELLOW_PIN_DESCRIPTION" />
</RelativeLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp" >
<ImageView
android:id="@+id/greenPinImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/green_pin"
android:contentDescription="@string/A_MORE_GREEN_PIN_IMAGE" />
<TextView
android:id="@+id/greenPinText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/greenPinImage"
android:text="@string/A_MORE_GREEN_PIN_DESCRIPTION" />
</RelativeLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp" >
<TextView
android:id="@+id/thanksText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="@string/A_MORE_CREATED_BY_TEXT" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
Edit: I can't remember exactly what I changed but I was able to get it to work with this xml:
<?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" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="55dp" >
<TextView
android:id="@+id/mainDescText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:lines="3"
android:scrollHorizontally="false"
android:text="@string/A_MORE_DESCRIPTION_TEXT" />
</LinearLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="80dp" >
<TextView
android:id="@+id/ageCurrentText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/ageButton"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:gravity="center"
android:text="@string/A_MORE_CURRENT_SIGHTINGS_AGE" />
<Button
android:id="@+id/ageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:onClick="loadSightingsAge"
android:text="@string/A_MORE_SIGHTINGS_AGE_BUTTON" />
</RelativeLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:layout_marginTop="10dp" >
<TextView
android:id="@+id/languageCurrentText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/languageButton"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:gravity="center"
android:text="@string/A_MORE_CURRENT_LANGUAGE" />
<Button
android:id="@+id/languageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:onClick="loadLanguage"
android:text="@string/A_MORE_LANGUAGE_BUTTON" />
</RelativeLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp" >
<ImageView
android:id="@+id/redPinImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/red_pin"
android:contentDescription="@string/A_MORE_RED_PIN_IMAGE" />
<TextView
android:id="@+id/redPinText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/redPinImage"
android:lines="3"
android:scrollHorizontally="false"
android:text="@string/A_MORE_RED_PIN_DESCRIPTION" />
</RelativeLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp" >
<ImageView
android:id="@+id/yellowPinImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/yellow_pin"
android:contentDescription="@string/A_MORE_YELLOW_PIN_IMAGE" />
<TextView
android:id="@+id/yellowPinText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/yellowPinImage"
android:lines="3"
android:scrollHorizontally="false"
android:text="@string/A_MORE_YELLOW_PIN_DESCRIPTION" />
</RelativeLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp" >
<ImageView
android:id="@+id/greenPinImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/green_pin"
android:contentDescription="@string/A_MORE_GREEN_PIN_IMAGE" />
<TextView
android:id="@+id/greenPinText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/greenPinImage"
android:lines="3"
android:scrollHorizontally="false"
android:text="@string/A_MORE_GREEN_PIN_DESCRIPTION" />
</RelativeLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp" >
<TextView
android:id="@+id/thanksText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:gravity="center"
android:lines="3"
android:scrollHorizontally="false"
android:text="@string/A_MORE_CREATED_BY_TEXT" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
I had the same exact problem. Let me just say that i just recently changed from using the Android 2.3.3 Platform up to Android 4.0.3 platform cause I wanted to take advantage of the Holo themes. So my default theme looked like this.
<style name="mytheme" parent="android:Theme.Holo">
<item name="android:windowNoTitle">true</item>
</style>
All my textViews looked great on my phone running Android 4.0.3
But when I ran my app in an emulator running Android 2.3.3 none of the textViews wrapped. I googled and googled and pretty much tried every combination of:
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:ellipsize="none"
android:layout_weight="1"
Nada. So then I decided to revert to my original theme:
<style name="myapp" parent="android:Theme.Black.NoTitleBar"/>
Viola! TextViews started wrapping again. Go figure. Not a real solution but maybe someone else can shed some light on why.
这篇关于Android的TextView的文字不是2.3.3版本中的RelativeLayout包装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!