我在布局中有一个搜索栏,用于自定义对话框首选项。我更改了 styles.xml 以使用新的材质设计。它之所以有效,是因为它更改了我的设置的文本和复选框,但我无法将颜色应用到我的搜索栏。仅当我在活动中放置搜索栏时它才有效,这意味着我必须在自定义布局中执行某些操作,但我不知道做什么。我发布了 styles.xml 和带有搜索栏的布局:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppBaseTheme" parent="android:Theme.Material">
<!-- Main theme colors -->
<!-- your app's branding color (for the app bar) -->
<item name="android:colorPrimary">#FFFF4444</item>
<!-- darker variant of colorPrimary (for status bar, contextual app bars) -->
<item name="android:colorPrimaryDark">#FFCC0000</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">#FFFF00</item>
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
</style>
</resources>
对话框首选项的自定义布局:
<?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"
android:orientation="vertical" >
<SeekBar
android:id="@+id/seek_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dip"
android:theme="@android:style/Theme.Material"
android:layout_marginTop="6dip" />
</LinearLayout>
有了 Lollipop,就不再需要它了。颜色应用得很好
即使在自定义首选项对话框中〜灰狼82
我想分享一些自定义库
你可以用这个材料设计库,这还包括许多其他小部件。
or
自定义搜索栏库离散搜索栏
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)