久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Android Word-Wrap EditText 文本

Android Word-Wrap EditText text(Android Word-Wrap EditText 文本)
本文介紹了Android Word-Wrap EditText 文本的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我一直在嘗試讓我的 EditText 框自動換行,但似乎無法做到.

I have been trying to get my EditText box to word wrap, but can't seem to do it.

我在開發 Android 應用程序時處理了更復雜的問題,這似乎應該是一個簡單的過程.

I have dealt with much more complicated issues while developing Android applications, and this seems like it should be a straightforward process.

但是,問題仍然存在,我有一個大文本框,它只允許我在一行上輸入文本,繼續直行,在我輸入文本時水平滾動.

However, the issue remains, and I have a large text box that is only allowing me to enter text on one line, continuing straight across, scrolling horizontally as I enter text.

這是我的布局文件中 EditText 對象的 XML 代碼.

Here is the XML code for the EditText object from my layout file.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:id="@+id/myWidget48"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android"
    >
 <ScrollView
    android:id="@+id/myScrollView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    >
    <LinearLayout
        android:id="@+id/widget37"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
    >

<EditText
        android:id="@+id/txtNotes"
        android:layout_width="300px"
        android:layout_height="120px"
        android:scrollbars="vertical"
        android:textSize="18sp"
        android:gravity="left"
        android:layout_marginTop="10dip"
        android:inputType="textCapSentences"
        >
    </EditText>
</LinearLayout>
</ScrollView>
</LinearLayout>

推薦答案

除了找到問題的根源,我找到了解決方案.如果使用 android:inputType,則必須使用 textMultiLine 來啟用多行支持.此外,使用 inputType 取代了代碼 android:singleLine="false".如果使用 inputType,那么重申一下,必須使用 textMultiLine,否則 EditText 對象將僅包含一行,沒有自動換行.

Besides finding the source of the issue, I found the solution. If android:inputType is used, then textMultiLine must be used to enable multi-line support. Also, using inputType supersedes the code android:singleLine="false". If using inputType, then, to reiterate, textMultiLine must be used or the EditText object will only consist of one line, without word-wrapping.

感謝Jacob Malliet就此提供進一步的好建議.他建議將 boolean scrollHorizo??ntally 屬性設置為 false,'android:scrollHorizo??ntally="false"'.

Thank you Jacob Malliet for providing further good advice on this. He suggested to set the boolean scrollHorizontally property to false, 'android:scrollHorizontally="false"'.

示例 XML 代碼:

<EditText
    android:id ="@+id/edtInput"
    android:layout_width ="0dip" 
    android:layout_height ="wrap_content" 
    android:layout_weight ="1" 
    android:inputType="textCapSentences|textMultiLine"
    android:maxLines ="4" 
    android:maxLength ="2000" 
    android:hint ="@string/compose_hint"
    android:scrollHorizontally="false" />

這篇關于Android Word-Wrap EditText 文本的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

EditText: Disable Paste/Replace menu pop-up on Text Selection Handler click event(EditText:禁用文本選擇處理程序單擊事件上的粘貼/替換菜單彈出)
Multiline EditText with Done SoftInput Action Label on 2.3(2.3 上帶有完成 SoftInput 操作標簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測向左或向右滑動?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉對話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設置為僅接受 Android 中的數值?)
主站蜘蛛池模板: 日韩中文一区二区三区 | av一级久久| 一区二区三区视频免费观看 | 四虎影视免费观看 | 久久久久久999 | 午夜影院 | 国产美女在线播放 | 亚洲国产一区二区视频 | 一本大道久久a久久精二百 国产成人免费在线 | 天天看片天天干 | 精品欧美二区 | 一级黄色片一级黄色片 | 国产一级特黄aaa大片评分 | 午夜免费 | 啪啪av | 中文字幕av在线 | 丝袜 亚洲 欧美 日韩 综合 | 亚洲精品久久久久久宅男 | 国产午夜亚洲精品不卡 | 亚洲婷婷六月天 | 国产精品福利在线 | 欧美国产激情二区三区 | 精品久久久久久国产 | 日本三级线观看 视频 | 五月天婷婷综合 | 久久久蜜桃 | 国产一级视频免费播放 | 三级在线视频 | 成人在线免费看 | 久久精品成人热国产成 | 91中文 | 欧美日韩精品中文字幕 | 一道本在线 | 亚洲精品在线播放 | 91精品入口蜜桃 | 亚洲国产网站 | 欧美三级视频 | 欧美lesbianxxxxhd视频社区 | 久久久www | 成人一级视频在线观看 | 夜夜操操操 |