我想从我的应用程序中删除标题栏,但是当使用以下代码时,标题栏并不隐藏,实际上它变得透明,内容被向下推送:
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);因此,我在标题栏(通知栏和应用程序之间)之间有一个空白。我到处都找过了,但没有找到类似的东西。
编辑:
我尝试过seretum和harism提供的两种解决方案(如下所示),但我仍然找不到问题,这是我的xml代码的一部分:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fff">
<ImageView android:id="@+id/title"
android:src="@drawable/main"
android:layout_width="480dp"
android:layout_height="155dp"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"/>不知怎么的,ImageView没有对齐相对布局的顶部.
最后编辑。解决方案:
因此,我对xml进行了修改,发现当您将自定义维度设置为小部件并使用Realtuve布局时,无论标题栏是否存在,widget都将位于其下方。因此,下面是解决方案(您需要将对象放在布局中):
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fff">
<LinearLayout android:id="@+id/title"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_width="wrap_content"
android:maxHeight="155dp"
android:maxWidth="480dp"
android:layout_height="wrap_content">
<ImageView android:src="@drawable/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true"/>发布于 2011-04-03 21:28:08
你有没有试过按不同的顺序要求任何头衔;
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);为我工作。
发布于 2011-04-03 21:29:28
在应用程序的AndroidManifest.xml中,在“应用程序”标记中,将
android:theme="@android:style/Theme.NoTitleBar"那会把你的酒吧从每一个活动中移除。
https://stackoverflow.com/questions/5532646
复制相似问题