首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用cutome标题栏时未获得sdk版本15的功能

使用cutome标题栏时未获得sdk版本15的功能
EN

Stack Overflow用户
提问于 2012-07-16 14:02:08
回答 1查看 133关注 0票数 1

我的应用程序minSdkVersion是15,所以当用户触摸应用程序中的按钮时,它会变成浅蓝色。后来,我为应用程序添加了一个自定义标题。之后,当用户触摸我的应用程序组件时,它的颜色将变为橙色。我发现这是自定义标题的问题。如何解决这个问题。我需要sdk版本15的功能。请参阅我如何添加自定义标题栏。

我的宣言。

代码语言:javascript
复制
<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" 
    android:theme="@style/CustomTheme">

我的样式用于客户标题栏(custom_style.xml)

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name="CustomTheme" parent="android:Theme">
            <item name="android:windowTitleSize">30dip</item>
        </style>
    </resources>

活动代码,其中它将更改为自定义标题栏

代码语言:javascript
复制
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

    setContentView(R.layout.main);

    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);

我的标题栏布局(window_title.xml)

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="30dip"
android:background="#FF0000" >

 <ImageView
    android:id="@+id/header"
    android:src="@drawable/ic_launcher"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="left"/>

<Switch
    android:id="@+id/laodAutomatically"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="MirrorLink auto-connect" 
    style="@android:style/Theme.Holo"
    android:layout_alignParentRight="true"
     />


</RelativeLayout>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-07-16 16:03:02

你的主题应该继承自主题,这是SDK 15的主题。有一个很好的教程可以让你开始支持各种主题和样式的SDK版本。希望这能有所帮助。

http://developer.android.com/guide/topics/ui/themes.html

您的主题应该有选择地继承主题或android:Theme.Light,这取决于平台版本。看看这一页的末尾。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11498832

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档