【发布时间】:2021-01-17 14:49:08
【问题描述】:
我设置了一个自定义标题栏作为示例 http://coderzheaven.com/2011/06/custom-title-bar-in-android/ ,一切正常,但仍然从原始标题出现蓝框。我唯一添加的是将背景颜色设置为自定义标题为 (android:background="#EECBAD")。如何去除这个蓝框?
###custom_title.xml:
<RelativeLayout
android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#EECBAD"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:layout_width="40dip"
android:id="@+id/ImageView01"
android:background="@drawable/ic_launcher"
android:layout_height="40dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv"
android:text="ELNABIH"
android:layout_toRightOf="@+id/ImageView01"
android:textColor="@drawable/red"
android:textStyle="bold"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip" />
</RelativeLayout>
java.class
package com.test.list;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.widget.TextView;
public class Tttt extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Boolean customTitleSupported = requestWindowFeature
(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
if (customTitleSupported) {
getWindow().setFeatureInt
(Window.FEATURE_CUSTOM_TITLE,R.layout.custom_title);
TextView tv = (TextView) findViewById(R.id.tv);
tv.setText("name");
}
}
}
【问题讨论】:
-
请在您修改背景的地方添加您的布局代码
-
你能提供你的主布局文件的内容吗?