SunShine Style 问题

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/sunshine_blue</item>
        <item name="colorPrimaryDark">@color/sunshine_dark_blue</item>
    </style>

    <!-- Main activity theme. -->
    <style name="ForecastTheme" parent="AppTheme">
        <item name="actionBarStyle">@style/ActionBar.Solid.Sunshine.NoTitle</item>
    </style>

    <!-- main activity action bar styles -->
    <style name="ActionBar.Solid.Sunshine.NoTitle" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
        <item name="displayOptions">useLogo|showHome</item>
        <item name="logo">@drawable/ic_logo</item>
    </style>

    <!-- Style for forecast listview -->
    <style name="ForecastListStyle">
        <!-- Here it's a stub.  In screens of sufficient width, this style includes modifications
        for two-pane layout -->
    </style>
</resources>

定义了一个ActionBarStyle,然后里面有两个属性,displayOptions和logo,这个在R.attr中有,以后还要慢慢学习这些设置


2.这些Theme和style定义好了之后,然后需要在Manifest文件中添加,比如下面,MainActivity设置Theme,不过最后显示的很好看,这是怎么显示的?

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity"
        android:theme="@style/ForecastTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

3.突然有一阵点击详情,跳转,然后返回就回到点击的那个位置,但是加了V14style,突然不行了

4.

添加设置栏此节点的差异再来一个快速调整。我们将添加一个更新,使操作栏出现在设置中。三个主题分别是 AppTheme、ForecastTheme 和 SettingsTheme,我们将有 v21 和 v14 版本。New action bars 这是风格文件的更新 gist。在您的 SettingsActivity 的 AndroidManifest 标签中,您可能想添加设置主题:android:theme="@style/SettingsTheme"### 如果您在想为什么没有操作栏……操作栏没有出现的原因是 appcompat(提供向后兼容性的库)的当前版本为我们的程序设置风格。Appcompat 仅为来自未将 ActionBarActivity 划入子类的 ActionBarActivity 和 SettingsActivity 的活动添加操作栏。SettingsActivity 是 PreferenceActivity 的子类。那么我们为什么使用 PreferenceActivity?因为它是获得 Gingerbread 设备上运行的偏好 UI 的简单途径。通过使用来自 DarkActionBar 的主题为 SettingActivity 添加明确主题,我们就能够加回操作栏





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值