久久久久久久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在线 | 精品欧美一区二区在线观看视频 | 久久99视频 | 欧美日韩专区 | 国产视频1 | 可以在线看的黄色网址 | 一区二区中文 | 九色.com| 在线中文视频 | 久久精品aaa | 99综合 | 羞羞视频网站免费观看 | 免费国产视频在线观看 | 99久久电影 | 免费视频成人国产精品网站 | 精品日韩电影 | 久久久做 | 精品在线一区 | 在线亚洲人成电影网站色www | 综合激情av | 最新一级毛片 | 免费网站在线 | 国产线视频精品免费观看视频 | 亚洲欧美国产精品一区二区 | 欧美一区二区三区在线观看视频 | 夜夜草| 精品久久久久久红码专区 | 成人欧美一区二区三区在线播放 | 日韩亚洲欧美综合 | 日韩精品一区二区三区 | 999热精品视频 | 狠狠婷婷综合久久久久久妖精 | 最新午夜综合福利视频 | 免费午夜视频 | 国产精品久久久久久婷婷天堂 | 国产成人精品一区二区三区网站观看 | 国产一区二区三区在线 | 国产精品日产欧美久久久久 |