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

將edittext限制為單行

restrict edittext to single line(將edittext限制為單行)
本文介紹了將edittext限制為單行的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

可能重復:android-singleline-true-not-working-for-編輯文本

<EditText 
    android:id="@+id/searchbox"  
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:lines="1"
    android:scrollHorizontally="true"
    android:ellipsize="end"
    android:layout_weight="1"
    android:layout_marginTop="2dp"
    android:drawablePadding="10dp"
    android:background="@drawable/edittext"
    android:drawableLeft="@drawable/folder_full"
    android:drawableRight="@drawable/search"
    android:paddingLeft="15dp"
    android:hint="search...">
</EditText>

我想讓上面的 EditText 只有一行.即使用戶按下輸入",光標也不應該下到第二行.有人可以幫我做嗎?

I want to make the above EditText to have only single line. Even if the user presses "enter" the cursor should not get down to the second line. Can anybody help me doing that?

推薦答案

使用 android:maxLines="1"android:inputType="text"

您忘記了 android:maxLines 屬性.并參考 android:inputType 你的例子,下面會給出這個結果:

You forgot the android:maxLines attribute. And refer for android:inputType With your example, below will give this result:

<EditText 
    android:id="@+id/searchbox"  
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:maxLines="1"
    android:inputType="text"
    android:scrollHorizontally="true"
    android:ellipsize="end"
    android:layout_weight="1"
    android:layout_marginTop="2dp"
    android:drawablePadding="10dp"
    android:background="@drawable/edittext"
    android:drawableLeft="@drawable/folder_full"
    android:drawableRight="@drawable/search"
    android:paddingLeft="15dp"
    android:hint="search...">
</EditText>

這篇關于將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 中的數值?)
主站蜘蛛池模板: 狠狠草视频 | 成人一区二区三区 | 国产91丝袜在线熟 | 久久综合一区 | 在线观看免费国产 | 九九热在线免费观看 | 精品精品 | 欧美高清视频 | 在线免费观看日本视频 | 国产成人在线一区二区 | 国产一级片 | 国产在线成人 | 国产精品中文字幕在线播放 | 国产精品国产馆在线真实露脸 | 日韩欧美综合 | 欧美日韩中文字幕在线播放 | 亚洲午夜三级 | 亚洲国产精品久久久久 | av在线二区| 97免费视频在线观看 | 日韩手机在线看片 | 日韩欧美一级精品久久 | 偷拍自拍第一页 | 欧美日一区二区 | 日韩精品成人av | 久久久久久999 | 国产成人久久 | 久久久国产一区 | 亚洲一区二区三区四区av | 亚洲专区在线 | 日韩精品免费 | 一级黄色大片 | 久久成人一区 | 日韩欧美高清 | 日本欧美视频 | 日韩精品免费播放 | 国产精品久久久久无码av | 国产免费看 | 国产黄色大片在线观看 | 一区二区福利视频 | 国产精品久久久久久吹潮 |