我想改变编辑文本下面的蓝色,我不知道它是什么属性.
我尝试使用不同的背景颜色,但它不起作用.
我在下面附上了一张图片:

我试图让EditText我的应用程序中的所有内容都具有一致的外观.我知道我可以这样做:
<style name="App_EditTextStyle">
<item name="android:background">@drawable/filled_roundededges_box_dark</item>
<item name="android:textColor">#808080</item>
<item name="android:layout_height">45dip</item>
</style>
Run Code Online (Sandbox Code Playgroud)
然后我可以EditText通过这样做来制作一个特殊的风格:
<EditText ...
style="@style/App_EditTextStyle
...>
Run Code Online (Sandbox Code Playgroud)
但是这样我必须记住为EditText我的应用程序中的每一个单独设置样式,这很繁琐,如果不是容易出错的话.
有什么办法可以让它成为主题的一部分吗?这样我就不必将这种风格与每种风格联系起来了EditText.像这个虚构的代码块:
<style name="App_Theme" parent="@android:style/Theme.Holo">
...
<item name="android:EditTextSyle">@style/App_EditTextStyle</item>
...
<style>
Run Code Online (Sandbox Code Playgroud)
然后在我的AndroidManifest.xml我有类似的东西:
<application
....
android:theme="@style/App_Theme">
Run Code Online (Sandbox Code Playgroud)
还有瞧!所有我EditText都有一致的风格,而不必为每个实例指定样式.
我试图更改EditText光标指针颜色(从原色蓝色到白色),但没有解决方案适用于我的项目.我试图开发演示项目,其中相同的代码工作正常.这段代码适用于> = android 5.0
我不知道,我的值会覆盖哪个属性.我有两个选项可以解决这个问题: -
1.找到控制该颜色值的属性.
2.页面加载时(在onViewCreated中)通过java代码更改颜色值.
请建议如何解决此问题.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="my_text_layout_style">
<item name="android:textColor">#FFF</item>
<item name="android:textColorHint">#FFF</item>
<item name="colorAccent">#FFF</item>
<item name="colorControlNormal">#FFF</item>
<item name="colorControlActivated">#FFF</item>
<item name="colorControlHighlight">#FFF</item>
</style>
<style name="my_edit_text_style">
<item name="colorAccent">#FFF</item>
<item name="android:editTextStyle">@style/MyEditTextStyle</item>
</style>
<style name="MyEditTextStyle" parent="Widget.AppCompat.EditText" />
</resources>
Run Code Online (Sandbox Code Playgroud)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/base_disable_btn_bg_color"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:hint="just a hint"
app:hintTextAppearance="@style/my_text_layout_style"
android:theme="@style/my_text_layout_style"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:theme="@style/my_edit_text_style"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
AppLinearLayout appLinearLayout = (AppLinearLayout) view.findViewById(R.id.some_id);
EditText editText = new EditText(new ContextThemeWrapper(getContext(), …Run Code Online (Sandbox Code Playgroud)