如何在android中准备布局通知列表视图

如何在android中准备布局通知列表视图,android,Android,这是我的适配器列表视图项xml文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffff

这是我的适配器列表视图项xml文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:padding="10dp" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <com.lociiapp.utils.RoundedImageView
                android:id="@+id/notificationuserimage"
                android:layout_width="60dp"
                android:layout_height="60dp"
                android:layout_centerVertical="true"
                android:layout_margin="5dp"
                android:layout_marginTop="10dp"
                android:src="@drawable/index" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingBottom="10dp"
                android:textColor="#505050"
                android:textSize="16dp" />

            <TextView
                android:id="@+id/desc"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:textColor="#202020"
                android:textSize="14dp" />

            <LinearLayout
                android:id="@+id/linear2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageView
                    android:id="@+id/imageView1"
                    android:layout_width="wrap_content"
                    android:layout_height="25dip"
                    android:layout_weight=".5"
                    android:src="@drawable/accepticon" />

                <ImageView
                    android:id="@+id/imageView2"
                    android:layout_width="wrap_content"
                    android:layout_height="25dip"
                    android:layout_weight=".5"
                    android:src="@drawable/rejecticon" />

                <ImageView
                    android:id="@+id/runnimage"
                    android:layout_width="wrap_content"
                    android:layout_height="25dip"
                    android:src="@drawable/drive"
                    android:visibility="invisible" />

                <TextView
                    android:id="@+id/rejectedrequest"
                    android:layout_width="wrap_content"
                    android:layout_height="40dip"
                    android:singleLine="true"
                    android:text="Rejected"
                    android:visibility="invisible" />
            </LinearLayout>

            <TextView
                android:id="@+id/revresetime"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Just 5 Minute Ago"
                android:textColor="#000000"
                android:textSize="10dip" />
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

我当前的屏幕:

如何在适配器中设置列表视图项目我无法像给定屏幕那样设置项目:

我们必须创建一个屏幕

请设置我的列表视图项目,以便我可以将我当前的布局设置为给定的布局。我无法这样做,并且面临一些问题,请提供帮助和建议。

尝试此布局:(更改住宿ID)


希望这有帮助

确定等待让我尝试此错误:在程序包“android”中未找到属性“layout\u alignParentStart”的资源标识符错误即将出现请检查我的问题删除android:layout\u alignParentStart=“true”。在适配器的getview中,在膨胀视图时是否设置了根?或者你只是设置空值?记住将父对象作为根视图传递,将false作为充气方法的第三个参数传递。这是我的密码,请告诉我哪里出错了
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <com.lociiapp.utils.RoundedImageView
        android:id="@+id/notificationuserimage"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_margin="20dp"/>

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingBottom="10dp"
        android:textColor="#505050"
        android:textSize="16dp"
        android:text="Request for traveling"
        android:layout_toEndOf="@+id/notificationuserimage"
        android:layout_alignTop="@+id/notificationuserimage"
        android:layout_toRightOf="@+id/notificationuserimage"
        android:textStyle="bold"/>

    <TextView
        android:id="@+id/desc"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#202020"
        android:textSize="14sp"
        android:text="asd has requested to travel with you"
        android:layout_below="@+id/title"
        android:layout_alignLeft="@+id/title"
        android:layout_alignStart="@+id/title"/>

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="25dip"
        android:src="drawable/accepticon"
        android:layout_alignBottom="@+id/notificationuserimage"
        android:layout_toRightOf="@+id/notificationuserimage"
        android:layout_toEndOf="@+id/notificationuserimage"/>

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="25dip"
        android:src="@drawable/rejecticon"
        android:layout_alignTop="@+id/imageView1"
        android:layout_toRightOf="@+id/imageView1"
        android:layout_toEndOf="@+id/imageView1"/>

    <TextView
        android:id="@+id/revresetime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Just 5 Minute Ago"
        android:textColor="#000000"
        android:textSize="10sp"
        android:layout_alignTop="@+id/imageView2"
        android:layout_toRightOf="@+id/imageView2"
        android:layout_toEndOf="@+id/imageView2"
        android:layout_alignBottom="@+id/imageView2"
        android:gravity="center_vertical"/>

    <TextView
        android:id="@+id/rejectedrequest"
        android:layout_width="wrap_content"
        android:layout_height="40dip"
        android:singleLine="true"
        android:text="Rejected"
        android:visibility="invisible"
        android:layout_alignTop="@+id/revresetime"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"/>

    <ImageView
        android:id="@+id/runnimage"
        android:layout_width="wrap_content"
        android:layout_height="25dip"
        android:src="@drawable/drive"
        android:visibility="invisible"
        android:layout_alignTop="@+id/revresetime"
        android:layout_toLeftOf="@+id/rejectedrequest"
        android:layout_toStartOf="@+id/rejectedrequest"/>
</RelativeLayout>
convertView.setBackgroundColor(position % 2 == 0 ? getContext().getResources().getColor(R.color.gray_back) : getContext().getResources().getColor(android.R.color.white));