2014-12-28 65 views
0

美好的一天!Android:如何製作多行TextView?

我有一個ListView與新聞列表,但如果標題非常長 - 他失去了在屏幕的邊緣。

如何將文本換行到下一行? 我閱讀了很多關於此的帖子,但無法找到適合我的解決方案。

下面的代碼:

<android.support.v4.widget.SwipeRefreshLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/swipe_container" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 
<ListView 
    android:id="@+id/listView1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" 
    > 
</ListView> 
</android.support.v4.widget.SwipeRefreshLayout> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
tools:context="com.app.SportNewsReaderApp.NewsActivity" > 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/hello_world" 

    android:textSize="16.5dip" 
    android:padding="2dip" 
    android:minLines = "1" 
    android:maxLines = "100" 
    android:singleLine = "false" 
    android:inputType="textMultiLine" 
    android:scrollHorizontally="false" 
    android:lines="2" 
    /> 

</LinearLayout> 
+0

可能重複的[機器人ellipsize多的TextView](http://stackoverflow.com/questions/2160619/android-ellipsize-multiline-textview) –

回答

0

如何文本換行到下一行?

通過去除minLines屬性