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

Android Word-Wrap EditText 文本

Android Word-Wrap EditText text(Android Word-Wrap EditText 文本)
本文介紹了Android Word-Wrap EditText 文本的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我一直在嘗試讓我的 EditText 框自動(dòng)換行,但似乎無(wú)法做到.

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

我在開(kāi)發(fā) Android 應(yīng)用程序時(shí)處理了更復(fù)雜的問(wèn)題,這似乎應(yīng)該是一個(gè)簡(jiǎn)單的過(guò)程.

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

但是,問(wèn)題仍然存在,我有一個(gè)大文本框,它只允許我在一行上輸入文本,繼續(xù)直行,在我輸入文本時(shí)水平滾動(dòng).

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 對(duì)象的 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>

推薦答案

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

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就此提供進(jìn)一步的好建議.他建議將 boolean scrollHorizo??ntally 屬性設(shè)置為 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" />

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

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

相關(guān)文檔推薦

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 操作標(biāo)簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測(cè)向左或向右滑動(dòng)?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉(zhuǎn)對(duì)話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點(diǎn)擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設(shè)置為僅接受 Android 中的數(shù)值?)
主站蜘蛛池模板: 亚洲欧美中文日韩在线v日本 | 久久人| 欧美精品一二区 | 亚洲一二三区不卡 | 亚洲精品久久久一区二区三区 | 国产探花在线精品一区二区 | 在线观看视频91 | 久久在线视频 | 性欧美精品一区二区三区在线播放 | 久久tv在线观看 | 亚洲激情在线观看 | a在线观看| 国产精品3区 | jlzzjlzz欧美大全 | 影音先锋男 | 亚洲免费一区二区 | av网站在线播放 | 亚洲国产欧美日韩 | 夜夜草| 羞羞视频免费观 | 亚洲视频在线观看 | 99精品国自产在线 | 久热久热 | 亚洲欧美在线观看 | 欧美在线亚洲 | 久久免费视频网 | 久久久久久久91 | 四虎影院在线播放 | 狠狠操狠狠干 | 二区三区视频 | 国产精品久久久久久吹潮日韩动画 | 国产精品久久av | 久久亚洲精品国产精品紫薇 | 国产精品久久久久久久久免费 | 一级黄色片日本 | 精品免费看 | 欧美黑人一级爽快片淫片高清 | 欧美黄 片免费观看 | 9色视频在线 | 伊人伊人 | 久草网址 |