【问题标题】:i want to use 2 android themes in android manifist?我想在 android manifest 中使用 2 个 android 主题?
【发布时间】:2014-07-17 09:41:17
【问题描述】:

我尝试在一个 Activity 中使用 2 个主题,一个用于对话框,一个用于隐藏标题栏,在 AndroidManifest 中:

<activity>
  android:theme="@android:style/Theme.Dialog" 
    android:theme="@android:style/Theme.Black.NoTitleBar"
    android:label="@string/app_name" > (it show X here!!)
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

我一次只能使用一个...

【问题讨论】:

    标签: android android-layout android-activity android-manifest android-theme


    【解决方案1】:

    你可以这样试试。在 Styles.xml 中

    <?xml version="1.0" encoding="utf-8"?>
    

    <style name="ExampleTheme" parent="Theme.Sherlock.Light.DarkActionBar">
          <!-- <item name="homeAsUpIndicator">@drawable/new_indicator</item> -->
         <!--  <item name="android:homeAsUpIndicator">@drawable/new_indicator</item> -->
    </style>
    
     <style name="CustomTheme" parent="Theme.Sherlock.Light.DarkActionBar">
        <item name="homeAsUpIndicator">@drawable/new_indicator</item>
           <!-- <item name="android:homeAsUpIndicator">@drawable/new_indicator</item>  -->
    </style>
    

    在你的 menifeast.xml 中

      <application
        android:allowBackup="true"
        android:icon="@drawable/app_icon"
        android:label="@string/app_name"
        android:theme="@style/ExampleTheme" >
        <activity
            android:name="com.ebizzinfotech.regularcoupon.SplashActivity"
            android:theme="@style/Theme.Sherlock.Light.DarkActionBar" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
     <activity android:name="com.ebizzinfotech.regularcoupon.MainActivity"  
          android:screenOrientation="portrait"
          android:theme="@style/CustomTheme">
    </activity>
    

    【讨论】:

      【解决方案2】:

      你可以使用

      requestWindowFeature(Window.FEATURE_NO_TITLE);
      

      在您的Activity 中删除ActionbBar。你应该在setContentView之前使用它。

      如果您使用requestWindowFeature,请删除android:theme="@android:style/Theme.Black.NoTitleBar"

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-08-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多