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

具有自定義主題的 EditText 在選擇句柄下顯示下劃

EditText with custom theme shows underline under selection handle(具有自定義主題的 EditText 在選擇句柄下顯示下劃線)
本文介紹了具有自定義主題的 EditText 在選擇句柄下顯示下劃線的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我正在嘗試通過應用主題來修改 EditText 的下劃線顏色.

i am trying to modify the underline color of a EditText by applying a theme.

風格:

<style name="MyTheme.EditText" parent="Widget.AppCompat.EditText">
    <item name="colorControlActivated">@color/green</item>
</style>

編輯文本:

<EditText
    android:id="@+id/editText_amount"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="@string/hint_enter_amount"
    android:theme="@style/MyTheme.EditText"/>

基本上它可以工作,但是當我嘗試選擇或移動光標時,選擇句柄也會加下劃線.您可以在屏幕截圖中看到這一點.

Basically it works, but when i try to select or move the cursor the selection handle is also underlined. You can see this in the screenshot.

有人知道如何解決這個問題嗎?

Does someone know how to fix this?

推薦答案

你可以把這個樣式當作一個

You can use this style as a

<EditText 
   style="@style/MyTheme.EditText"/>

或者,您可以將主題分開以引用 editTextStyle 屬性.

Or, you can separate your theme for referencing the editTextStyle attribute.

<style name="MyEditTextStyle" parent="Widget.AppCompat.EditText">
    <item name="colorControlActivated">@color/green</item>
</style>

<style name="MyTheme.EditText">
    <item name="editTextStyle">@style/MyEditTextStyle</item>
</style>

<EditText
    android:theme="@style/MyTheme.EditText"/>

好的,但是這些下劃線是從哪里來的?

android:theme 是 View 的一個屬性,當您將樣式設置為 android:theme 時,該樣式將由具有上下文主題的 ContextThemeWrapper 包裝,同時膨脹查看.

android:theme is an attribute of View and when you set a style as android:theme, that style will be wrapped by ContextThemeWrapper with context theme while in inflation of view.

這意味著,如果您將 android:theme 屬性設置為包含 android:background 項目的樣式

So that means, if you set android:theme property with style that contains android:background item like

<item name="android:background">@color/green</item>

此主題所有者的每個子視圖都將具有綠色背景.

every child view of this theme owner will be have a green background.

"Widget.AppCompat.EditText" 是一種樣式,并將 ?attr/editTextBackground 引用為 "android:background".而在 v21/values-21.xml 文件中,@drawable/abc_edit_text_material 被定義為 editTextBackground.

"Widget.AppCompat.EditText" is a style and references ?attr/editTextBackground as a "android:background". And in v21/values-21.xml file @drawable/abc_edit_text_material is defined as editTextBackground.

因此,對于您的示例,@drawable/abc_edit_text_material 成為您的 EditText 和 SelectionHandlers 的背景.

So, for your example, @drawable/abc_edit_text_material becomes a background of your EditText and SelectionHandlers.

這篇關于具有自定義主題的 EditText 在選擇句柄下顯示下劃線的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Cut, copy, paste in android(在android中剪切、復制、粘貼)
android EditText blends into background(android EditText 融入背景)
Change Line Color of EditText - Android(更改 EditText 的線條顏色 - Android)
EditText showing numbers with 2 decimals at all times(EditText 始終顯示帶 2 位小數的數字)
Changing where cursor starts in an expanded EditText(更改光標在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 国产黄色av网站 | 久久综合av | 欧美在线视频不卡 | 亚洲精品视频网站在线观看 | 青青草免费在线视频 | 午夜影院在线视频 | 天天夜夜操 | 女女百合av大片一区二区三区九县 | 日韩精品在线播放 | 99热播精品 | 一区二区三区中文字幕 | 欧美美女爱爱视频 | 高清色视频| 日韩国产一区二区三区 | 亚洲传媒在线 | 天堂资源最新在线 | 国产亚洲久 | 国产精品美女久久久久aⅴ国产馆 | 亚洲欧美日韩中文字幕一区二区三区 | 国产精品久久久亚洲 | 青青久久久 | 欧美一级艳情片免费观看 | 久久久成人动漫 | 欧美日韩国产精品 | 中文字幕成人在线 | 四虎免费视频 | 久久午夜精品福利一区二区 | www.三级| 亚洲一区二区三区 | 毛片韩国 | 天天视频成人 | 亚洲91精品 | 人人叉 | 青草青草久热精品视频在线观看 | 91视频网| av黄色在线 | 青青草av网站 | 在线成人一区 | 国产精品一区二区欧美 | 亚洲免费片 | 天天操精品视频 |