在我的程序中,有时,我需要隐藏我的自定义标题,但我未能隐藏倾斜的背景图像。我可以很好地隐藏按钮和 Textview。我的代码(xml)如下。
标题 xml:viewimage_slide_title.xml
< RelativeLayout
android:background="@drawable/iphone_header_bg"
android:orientation="horizontal"
android:id="@+id/viewimage_slide_title">
<Button
android:id="@+id/third_image_button_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/third_title_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
样式.xml:
<color name="transparent">#00000000</color>
<style name="CustomWindowTitleBackground">
<item name="android:background">@drawable/iphone_header_bg</item>
</style>
<style
name="title" parent="android:Theme.Light">
<item name="android:windowTitleSize">50dp</item><item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
</style>
manifes.xml 。活动。我添加为:
<activity
android:name="com.android.camera.third.MianActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/view_label"
android:theme="@style/title"
android:screenOrientation="behind" >
在我的 java(MianActivity) 代码中:
titlebar = (RelativeLayout) findViewById(R.id.viewimage_slide_title);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.viewimage_slide);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
R.layout.viewimage_slide_title);
在我的其他 java 代码中:我愿意
MianActivity.titlebar.setVisibility(View.GONE);