我正在使用AppCompatEditText,我的布局是
<?php
// If loop is only entered if $_POST["name"] is not empty.
// $_POST[value] comes from the POST parameters, e.g., for example.com/ajax.html?name=Nick ...
if( $_POST["name"] ) {
$name = $_POST['name']; // ... then `echo $name` will print "Nick"
echo "Welcome ". $name;
}
?>
在样式中我定义为
<android.support.design.widget.TextInputLayout
android:id="@+id/text_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.app.dream11.UI.CustomEditTextView
android:id="@+id/edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter your name"
CustomEditTextView:fontType="Xanadu" />
</android.support.design.widget.TextInputLayout>
<style name="Widget.Design.TextInputLayout" parent="AppTheme">
<item name="hintTextAppearance">@style/AppTheme.TextFloatLabelAppearance</item>
<item name="errorTextAppearance">@style/AppTheme.TextErrorAppearance</item>
<item name="counterTextAppearance">@style/TextAppearance.Design.Counter</item>
<item name="counterOverflowTextAppearance">@style/TextAppearance.Design.Counter.Overflow
</item>
</style>
<style name="AppTheme.TextFloatLabelAppearance" parent="TextAppearance.Design.Hint">
<!-- Floating label appearance here -->
<item name="android:textColor">@color/warm_grey_two</item>
</style>
<style name="AppTheme.TextErrorAppearance" parent="TextAppearance.Design.Error">
<!-- Error message appearance here -->
<item name="android:textColor">@color/pale_red</item>
<item name="colorControlHighlight">@color/denim_blue</item>
</style>
但现在问题是当我设置edittext的线条颜色说蓝色然后文字颜色也变成蓝色但我想要 线条颜色应该不同,文字颜色也不同
答案 0 :(得分:0)
看看这个颜色主色和colorAccent这些用于焦点上的编辑文本行的颜色变化,焦点在其上做了更改
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> //this color change your line color of edittext
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColor">@color/colorPrimary</item>
//text color of edittext
<item name="colorControlNormal">@color/white_four</item>
<item name="colorControlActivated">@color/greyish_brown</item>
</style>
答案 1 :(得分:0)
<强> styles.xml 强>
<style name="EditTextCustom" parent="android:Widget.EditText">
<item name="android:background">@drawable/apptheme_edit_text_holo_light</item>
<item name="android:textColor">#ffffff</item>
</style>
XML代码:
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/EditTextCustom"/>