Android 我怎样才能在标题栏上显示?

Android 我怎样才能在标题栏上显示?,android,android-layout,Android,Android Layout,我有一个标题栏我的项目之一,我想使用我的所有屏幕。我想我可以做一个通用的方式我想要一个东西,我会像一个风格标签或主题标签一样到处调用我不知道。我可以用什么 我的标题栏在这里: RelativeLayout android:layout_height="44dip" android:layout_width="320dip" android:background="@drawable/merhaba_header_320_44

我有一个标题栏我的项目之一,我想使用我的所有屏幕。我想我可以做一个通用的方式我想要一个东西,我会像一个风格标签或主题标签一样到处调用我不知道。我可以用什么

我的标题栏在这里:

RelativeLayout
            android:layout_height="44dip"
            android:layout_width="320dip"
            android:background="@drawable/merhaba_header_320_44dip">
        <ImageView
            android:layout_height="32dip"
            android:layout_width="121dip"
            android:background="@drawable/merhaba_logo_121_32dip"
            android:layout_centerInParent="true">
        </ImageView>
        <ImageView
            android:layout_height="30dip"
            android:layout_width="64dip"
            android:background="@drawable/merhaba_btn_nedir_64_30dip"
            android:layout_margin="5dip"
            android:layout_alignParentRight="true">
        </ImageView>
    </RelativeLayout>

您好,DuyguK,您是否希望有一个标题栏,您可以将其作为主题或其他内容应用于应用程序中的所有活动

如果是这样的话,我建议你做以下几点。 首先在res/values/styles.xml中定义样式

<resources>
    <style name="MyTheme" parent="android:style/Theme.Light">
        <item name="android:windowTitleSize">44dip</item>
        //whatever item you want/need to edit for your custom title bar
    </style>
</resources>
这允许你有一个可应用于整个应用程序的主题。为此,您需要转到应用程序标记内的AndroidManifest.xml文件,添加以下内容:

<application android:label="@string/app_name"
    android:theme="@style/MyTheme">
android:theme告诉应用程序使用名为MyTheme的主题,该主题可以在项目的res/values/styles.xml文件中找到。 这样,您就可以将自定义标题栏正确应用于所有活动。 希望这能回答您的问题如果没有,请详细说明

另外一个建议是看看Android SDK中的示例附带的ActionBarCompat项目。Android开发者页面显示该项目:

它的优点是与API11之前的设备兼容,将其作为主题应用于您的应用程序,商店中的许多应用程序都在使用它。
如果您有任何疑问/问题,请告诉我。

创建您自己的风格,当然可以从现有主题扩展到现有主题。 将windowNoTitle更改为true

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="noTitleBarStyle" parent="android:Theme.Black">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@color/darkGrey</item>   
<item name="android:colorForeground">#ff3333</item> 
</style></resources>

您的问题是,如何将其应用于所有活动的视图?我想像一个样式一样编写一次,并像@style一样调用所有xml视图。我认为这可以做到,但我不知道真正的标记名