我的android应用程序中的标题/标题栏没有';不要把宽度和高度都包起来。

我的android应用程序中的标题/标题栏没有';不要把宽度和高度都包起来。,android,android-layout,android-titlebar,Android,Android Layout,Android Titlebar,所有活动中使用的代码为: requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mytitle); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); mytitle xml是: <?xml version="

所有活动中使用的代码为:

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mytitle);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
mytitle xml是:

 <?xml version="1.0" encoding="utf-8"?>
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:background="#FFFFF0" >

<ImageView
    android:id="@+id/mytitle"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scaleType="fitXY"
    android:src="@drawable/header_bloodbank2" />

</LinearLayout>

我的应用程序中的标题与其尺寸不匹配。我对宽度和高度属性都使用了“填充父项”。但是,没有帮助。 收割台没有完全包裹。背后的原因可能是什么?帮帮我!
还附上了一张快照

根据我对您的问题的理解,您正在尝试使用自定义标题栏背景图像,在本例中是“我捐赠”图像

我能想到的图像宽度没有被包装的唯一原因是图像没有那么宽。(另外,我猜您使用的是9png)。现在要更正它,只需将图像移动到低密度文件夹。例如,如果您的图像位于
可绘制hdpi
中,则将其从那里移动到
可绘制mdpi
文件夹

还可以按如下方式更改xml中的imageview:

<ImageView
android:id="@+id/mytitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:src="@drawable/header_bloodbank2" />

您的代码

<ImageView
android:id="@+id/mytitle"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:src="@drawable/header_bloodbank2" />


应该可以。检查您的图像周围是否没有任何透明边框。有时。png图像有透明边框,这会阻止图像填充整个宽度和高度。

任何图像都无法完全解释标题的含义。也可以查看帮助信息。我尝试了您所说的,但没有帮助。因为“centerInside”“将整个标题(即图像和文本)移到中心。是的,此链接似乎很有用。”。我看看它是否有效。谢谢不,它没有任何边框,但我会看看“fill\u parent”属性是否有帮助。fill\u parent属性也没有帮助!如果你能把你的照片发给我。我可以再试试。