程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> xml-關於TextView中文本太長的問題

xml-關於TextView中文本太長的問題

編輯:編程綜合問答
關於TextView中文本太長的問題

程序中的一個textview,有一段很長的文本。估計是由於這段文本太長,所以把整個布局都影響了。現在需要輸入很長的文本,所以應該以多行顯示。
我用的是下面的XML:

<TextView
            android:id="@+id/bottomText"
            android:layout_height="wrap_content"
            android:textColor="#FFFFFF"
            android:background="#000000"
            android:textSize="16sp"
            android:layout_gravity="center_horizontal"
            android:text="@string/text_searchword"
            android:layout_width="wrap_content">
</TextView>

如何解決這個問題呢?

最佳回答:


  <EditText
                    android:textColor="@android:color/black"
                    android:id="@+id/embedded_text_editor"
                    android:layout_width="0dip"
                    android:layout_gravity="bottom"
                    android:layout_height="wrap_content"
                    android:layout_weight="1.0"
                    android:layout_marginLeft="8dip"
                    android:autoText="true"
                    android:textSize="16sp"
                    android:capitalize="sentences"
                    android:nextFocusRight="@+id/send_button"
                    android:hint="@string/type_to_compose_text_enter_to_send"
                    android:minHeight="@dimen/input_text_height"
                    android:maxLines="3"
                    android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
                    android:imeOptions="actionSend|flagNoEnterAction"
                />

這個android源碼中信息界面的文本輸入框,可以找有用部分模仿下, 這個屬性
android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"可以多調整試下

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved