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>


郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。