Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Android应用程序中定义主题_Android_Android Theme - Fatal编程技术网

在Android应用程序中定义主题

在Android应用程序中定义主题,android,android-theme,Android,Android Theme,我已尝试添加清单 <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > 时尚 <resources> <!-- Base application theme, depend

我已尝试添加清单

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

时尚

<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:style/Theme.Holo.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>
</resources>

无论我做什么,我总是有黑色的动作条,没有任何变化。。。我想应用全息光主题


有什么建议吗?

如果您想在整个应用程序中使用该主题,请尝试以下方法:

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Holo.Light" >

如果您想在整个应用程序中使用该主题,请尝试以下方法:

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Holo.Light" >

如果您想在整个应用程序中使用该主题,请尝试以下方法:

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Holo.Light" >

如果您想在整个应用程序中使用该主题,请尝试以下方法:

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Holo.Light" >

创建自定义主题

首先,在值中添加一个themes.xml,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.Light.NoTitleBar">
    <!-- Any customizations for your app running on pre-3.0 devices here -->
    </style>
</resources> 

然后,在res目录中创建一个名为“values-v11”(Android 3.0+)的目录,并像这样放置一个themes.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.Holo.Light">
    <!-- Any customizations for your app running on 3.0+ devices here -->
    </style>
</resources>

最后,在res目录中创建一个名为“values-v14”(Android 4.0+)的目录,并创建一个themes.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
    <!-- Any customizations for your app running on 4.0+ devices here -->
    </style>
</resources>

manifest.xml

<application
    ...
    android:theme="@style/MyAppTheme">

</application>

或 创建自定义操作栏

actionbar_layout.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    style="@style/ActionBarCompat" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="15dip"
        android:paddingTop="15dip"
        android:scaleType="center"
        android:textColor="#ffffff"
        android:textSize="20sp"
        android:textStyle="bold"
        android:text="NAME" />

</LinearLayout>

在布局文件中。main_activity.xml

   <include layout="@layout/actionbar_layout"/>

在values->styles.xml中

<style name="ActionBarCompat">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">50dp</item>
    <item name="android:orientation">horizontal</item>
    <item name="android:background">@drawable/actionbar_background</item>
</style>

填补家长的空缺
50dp
水平的
@可绘制/操作栏\u背景
创建自定义主题

首先,在值中添加一个themes.xml,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.Light.NoTitleBar">
    <!-- Any customizations for your app running on pre-3.0 devices here -->
    </style>
</resources> 

然后,在res目录中创建一个名为“values-v11”(Android 3.0+)的目录,并像这样放置一个themes.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.Holo.Light">
    <!-- Any customizations for your app running on 3.0+ devices here -->
    </style>
</resources>

最后,在res目录中创建一个名为“values-v14”(Android 4.0+)的目录,并创建一个themes.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
    <!-- Any customizations for your app running on 4.0+ devices here -->
    </style>
</resources>

manifest.xml

<application
    ...
    android:theme="@style/MyAppTheme">

</application>

或 创建自定义操作栏

actionbar_layout.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    style="@style/ActionBarCompat" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="15dip"
        android:paddingTop="15dip"
        android:scaleType="center"
        android:textColor="#ffffff"
        android:textSize="20sp"
        android:textStyle="bold"
        android:text="NAME" />

</LinearLayout>

在布局文件中。main_activity.xml

   <include layout="@layout/actionbar_layout"/>

在values->styles.xml中

<style name="ActionBarCompat">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">50dp</item>
    <item name="android:orientation">horizontal</item>
    <item name="android:background">@drawable/actionbar_background</item>
</style>

填补家长的空缺
50dp
水平的
@可绘制/操作栏\u背景
创建自定义主题

首先,在值中添加一个themes.xml,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.Light.NoTitleBar">
    <!-- Any customizations for your app running on pre-3.0 devices here -->
    </style>
</resources> 

然后,在res目录中创建一个名为“values-v11”(Android 3.0+)的目录,并像这样放置一个themes.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.Holo.Light">
    <!-- Any customizations for your app running on 3.0+ devices here -->
    </style>
</resources>

最后,在res目录中创建一个名为“values-v14”(Android 4.0+)的目录,并创建一个themes.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
    <!-- Any customizations for your app running on 4.0+ devices here -->
    </style>
</resources>

manifest.xml

<application
    ...
    android:theme="@style/MyAppTheme">

</application>

或 创建自定义操作栏

actionbar_layout.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    style="@style/ActionBarCompat" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="15dip"
        android:paddingTop="15dip"
        android:scaleType="center"
        android:textColor="#ffffff"
        android:textSize="20sp"
        android:textStyle="bold"
        android:text="NAME" />

</LinearLayout>

在布局文件中。main_activity.xml

   <include layout="@layout/actionbar_layout"/>

在values->styles.xml中

<style name="ActionBarCompat">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">50dp</item>
    <item name="android:orientation">horizontal</item>
    <item name="android:background">@drawable/actionbar_background</item>
</style>

填补家长的空缺
50dp
水平的
@可绘制/操作栏\u背景
创建自定义主题

首先,在值中添加一个themes.xml,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.Light.NoTitleBar">
    <!-- Any customizations for your app running on pre-3.0 devices here -->
    </style>
</resources> 

然后,在res目录中创建一个名为“values-v11”(Android 3.0+)的目录,并像这样放置一个themes.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.Holo.Light">
    <!-- Any customizations for your app running on 3.0+ devices here -->
    </style>
</resources>

最后,在res目录中创建一个名为“values-v14”(Android 4.0+)的目录,并创建一个themes.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
    <!-- Any customizations for your app running on 4.0+ devices here -->
    </style>
</resources>

manifest.xml

<application
    ...
    android:theme="@style/MyAppTheme">

</application>

或 创建自定义操作栏

actionbar_layout.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    style="@style/ActionBarCompat" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="15dip"
        android:paddingTop="15dip"
        android:scaleType="center"
        android:textColor="#ffffff"
        android:textSize="20sp"
        android:textStyle="bold"
        android:text="NAME" />

</LinearLayout>

在布局文件中。main_activity.xml

   <include layout="@layout/actionbar_layout"/>

在values->styles.xml中

<style name="ActionBarCompat">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">50dp</item>
    <item name="android:orientation">horizontal</item>
    <item name="android:background">@drawable/actionbar_background</item>
</style>

填补家长的空缺
50dp
水平的
@可绘制/操作栏\u背景

已尝试。。。您是否为活动定义了布局?已尝试。。。您是否为活动定义了布局?已尝试。。。您是否为活动定义了布局?已尝试。。。您是否为您的活动定义了布局?