我正在使用Appcompatv7 21并尝试自定义editText字段.
奇怪的是,它在棒棒糖上工作正常,但不适用于kitkat或任何棒棒糖前装置.我认为支持库可以在所有平台上运行.
<style name="mApptheme" parent="theme.AppCompat.light.NoActionbar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="colorControlnormal">@color/verylightGrey</item> <item name="colorControlActivated">@color/colorAccent</item> <item name="colorControlHighlight">@color/colorAccent</item></style>compile 'com.androID.support:appcompat-v7:21.0.3'
物理设备的屏幕截图.
解决方法:
尝试在EditText中添加下一个代码
检查真实设备.
在我的EditText工作中,这是我的EditText:
<EditText androID:ID="@+ID/editTextFacebookID" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_centerVertical="true" androID:layout_marginleft="64dp" androID:layout_marginRight="8dp" androID:gravity="center_vertical" androID:hint="Facebook ID" androID:textcolor="@color/md_text" androID:textcolorHint="@color/md_Disabled_hint_text" />
您可以在此处检查md_text和md_Disabled_hint_text颜色:Google Colors
这是我的应用程序的v19风格:
<style name="Apptheme" parent="theme.AppCompat.NoActionbar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/md_red_500</item> <item name="colorPrimaryDark">@color/md_red_700</item> <item name="colorAccent">@color/md_blue_A200</item> <item name="colorControlHighlight">@color/md_black_1000_25</item> <item name="colorControlnormal">@color/md_black_1000_50</item> <item name="colorSwitchThumbnormal">@color/md_grey_200</item> <item name="androID:colorForeground">@color/md_black_1000_75</item> <item name="androID:windowTranslucentNavigation">@bool/translucentNavigationbar</item> <item name="androID:windowTranslucentStatus">@bool/translucentStatusbar</item> <!-- Navigation Drawer Arrow Style. --> <item name="drawerArrowStyle">@style/DrawerArrowStyle</item> <!-- Overflow button Style. --> <item name="actionOverflowbuttonStyle">@style/OverflowStyle</item></style>
我的EditText在未聚焦时为灰色,而蓝色聚焦,它采用colorAccent的颜色.
当我更改Apptheme时它会改变颜色.
总结以上是内存溢出为你收集整理的如何使用AppCompat v7:21在android中自定义EditText字段全部内容,希望文章能够帮你解决如何使用AppCompat v7:21在android中自定义EditText字段所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)