首页 > 代码库 > Android 自定义title

Android 自定义title

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);   
		setContentView(Res.layout(this, "layout_select"));   //软件activity的布局
		getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, Res.layout(this, "layout_title_bar"));  //titlebar为自己标题栏的布局
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
		


<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="PayHubWindowTitleBackground">
        <item name="android:background">@color/title_bg</item>
    </style>

    <style name="TitleBar_Pay_Hub" parent="android:Theme">
        <item name="android:windowTitleBackgroundStyle">@style/PayHubWindowTitleBackground</item>
    </style>
    
    <style name="TitleTheme" parent="android:Theme">      
          
        <!-- Window attributes -->  
        <item name="android:windowTitleBackgroundStyle">@style/PayHubWindowTitleBackground</item> 
        <item name="android:windowTitleSize">@dimen/title_height</item>
    </style>

</resources>


<activity
            android:name="com.lenovo.newui.SelectActivity"
            android:configChanges="keyboardHidden|orientation|navigation"
            android:screenOrientation="portrait"
            android:theme="@style/TitleTheme" >
        </activity>


Android 自定义title