簡體   English   中英

Android:如何制作多行TextView?

[英]Android: How to make multiline 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>

如何將文字換行到下一行?

通過刪除minLines屬性

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM