如何在android中添加固定标题的背景图像,然后添加滚动列表视图

如何在android中添加固定标题的背景图像,然后添加滚动列表视图,android,android-intent,Android,Android Intent,我是android的初学者。我只是想澄清我的概念。所以我开始在android上制作我的第一个屏幕。我想添加背景图像。然后是一个固定的标题(标题上有三个按钮)。然后滚动列表视图?你能帮我吗。我知道我必须用xml编码。只要给我一些提示,我就可以开始。我有所有的图像 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.c

我是android的初学者。我只是想澄清我的概念。所以我开始在android上制作我的第一个屏幕。我想添加背景图像。然后是一个固定的标题(标题上有三个按钮)。然后滚动列表视图?你能帮我吗。我知道我必须用xml编码。只要给我一些提示,我就可以开始。我有所有的图像

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".First_activity" 
    android:background="@drawable/a">
   <RelativeLayout
    android:id="@+id/main_title"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
      android:src="@drawable/header" >

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true" 
        >

        <ImageButton
              android:id="@+id/setting"

            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
             android:src="@drawable/settings" />

        <ImageButton
            android:id="@+id/add"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            android:src="@drawable/add"/>

        <ImageButton
             android:id="@+id/edit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
             android:src="@drawable/edit"  />

    </RelativeLayout>

</RelativeLayout>

   <ListView
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
</ListView>
</RelativeLayout>

到目前为止,我成功地做到了这一点

标题图像未显示..三个按钮未显示。。?

根据您所说的,您需要使用线性布局,在该布局中,项目可以水平放置,也可以垂直放置。在本例中,您将有一个垂直定向的主LinearLayout,它将包含两个子项:一个LinearLayout和一个ListView

第二个线性布局将具有水平方向,在这里您将放置按钮。ListView将表示您的可滚动列表。但在开始之前,我建议你阅读android官方文档上的布局和列表视图。正如你所说的,你知道xml,我没有给出任何实际的例子,只是试图从理论上解释,如果你需要的话,就说出来

我希望这有帮助

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    >

`

第一步:无效文件名:必须只包含[a-z0-9.],为图像输入一些好的名称,确保只使用字母。为什么不显示标题图像?第二,三个图像不显示,只有一个可能会有一些填充。。?
<RelativeLayout
    android:id="@+id/main_title"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/header" >

    <ImageButton
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/ic_launcher" />

    <ImageButton
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_toLeftOf="@+id/imageView1"
        android:src="@drawable/ic_launcher" />

    <ImageButton
        android:id="@+id/imageView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_toLeftOf="@+id/imageView2"
        android:src="@drawable/ic_launcher" />

</RelativeLayout>

<ListView
    android:id="@+id/listView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_marginBottom="104dp" 
    android:layout_below="@id/main_title">
</ListView>