我有TextView
,文字很长。在图形布局中,它显示精美的包装文本,但是当我运行它时,它不会包装文本。这是我的设计代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:layout_marginLeft="5dp"
android:background="#ffffff" >
<RelativeLayout
android:id="@+id/layout_title"
style="@style/dialog_header" >
<ImageView
android:id="@+id/image_title"
style="@style/dialog_header_image"
android:contentDescription="@string/update_reply"
android:src="@drawable/compose" />
<TextView
android:id="@+id/txt_title"
style="@style/dialog_header_title"
android:layout_toRightOf="@+id/image_title" />
</RelativeLayout>
<ScrollView
android:id="@+id/layout_message"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/layout_title"
android:fadingEdge="none"
android:fillViewport="true" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp" >
<TextView
android:id="@+id/txt_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="130dp"
android:text="Don't work too hard to give yourself the best of everything, instead make a greater effort to give God the best of yourself." />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/button_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/layout_message" >
<Button
android:id="@+id/btn_reply"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/reply" />
<Button
android:id="@+id/btn_forward"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/forward" />
</LinearLayout>
</RelativeLayout>
我想展示这个,但它只显示一行
答案 0 :(得分:0)
删除此
android:minHeight="130dp"
并更改textview的高度值
android:layout_height="XXXdp"
答案 1 :(得分:0)
试试这个
android:text="Don't work too hard to give yourself the\n best of everything, instead make a greater\n effort to give God the best of yourself."
答案 2 :(得分:0)
要进行文字换行,请在android:singleLine=false
中设置TextView
。
http://developer.android.com/reference/android/widget/TextView.html#attr_android:singleLine