Android-自定义标题栏

Android-自定义标题栏,android,android-layout,android-titlebar,Android,Android Layout,Android Titlebar,我想为Android应用程序自定义标题栏。我的布局如下: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_h

我想为Android应用程序自定义标题栏。我的布局如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="80dp" <!-- Problem here -->
    android:gravity="center_vertical"
    >

    <ImageView
        android:id="@+id/header"
        android:background="@drawable/windowtitle"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>

</LinearLayout>
我不明白为什么更改
android:layout\u height
值时标题栏的高度没有改变

我错过什么了吗


谢谢

将布局高度设置为线性布局的换行内容或填充父级


然后尝试将布局高度设置为线性布局的换行内容或填充父级

然后尝试它

根据,您应该为此创建自定义样式。查看它是否适合您。

根据,您应该为此创建自定义样式。看看它是否适合您。

您可以使用:

getWindow().setLayout(50, 50);
当然,此代码用于设置窗口的宽度和高度,您可以使用:

getWindow().setLayout(50, 50);

当然,这段代码用于设置窗口的宽度和高度实际上,我已经阅读了它,并应用了其中的内容。。。虽然我不明白为什么我们需要提供一个自定义样式,因为我们有
窗口标题
布局。自定义_样式给等式增加了什么?事实上,我已经阅读了它,并应用了其中的内容。。。虽然我不明白为什么我们需要提供一个自定义样式,因为我们有
窗口标题
布局。自定义_样式为等式添加了什么?我想设置自定义高度。另外,当提供图像背景时,图像会拉伸以填充宽度,因此比例与原始图像不同。我想设置一个自定义高度。此外,当提供图像背景时,图像会拉伸以填充宽度,因此比例与原始比例不同。