bau*_*664 4 android android-layout navigation-drawer
我正在使用导航抽屉使用此示例.我想把蓝色改成橙色我怎么能这样做?我的意思是改变listview选择器颜色,actionbar selctor颜色的一切.
您可以使用选择器
在drawable文件夹中有如下的selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/press" />
<item android:state_focused="false"
android:drawable="@drawable/normal" />
</selector>
Run Code Online (Sandbox Code Playgroud)
在drawable文件夹中的press.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FF9D21"/>
</shape>
Run Code Online (Sandbox Code Playgroud)
在drawable foldernormal.xml中
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#8BC7EB"/>
</shape>
Run Code Online (Sandbox Code Playgroud)
在drawer_list_item.xml中
android:background="@drawable/selector"
Run Code Online (Sandbox Code Playgroud)
用于造型吧
<resources>
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<item name="android:background">@style/MyActionBar</item>
<!-- API 11 theme customizations can go here. -->
</style>
<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:background">@drawable/press</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
在你的清单中
<activity
android:name=".MainActivity"
android:theme="@style/MyActionBar"
android:label="@string/app_name">
Run Code Online (Sandbox Code Playgroud)
您可以为特定活动而不是整个应用程序指定主题.
更多信息
http://android-developers.blogspot.in/2011/04/customizing-action-bar.html
https://developer.android.com/training/basics/actionbar/styling.html
快照

| 归档时间: |
|
| 查看次数: |
39478 次 |
| 最近记录: |