Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 显示recyclerview演示时出错_Android_Android Recyclerview - Fatal编程技术网

Android 显示recyclerview演示时出错

Android 显示recyclerview演示时出错,android,android-recyclerview,Android,Android Recyclerview,我面临的问题与recycleview。我想用折叠工具栏和嵌套滚动来完成一项任务。在那个嵌套的卷轴中,我想使用recycler视图来获取图像 05-15 10:07:37.227 3660-3660/com.example.welcome.dem E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example

我面临的问题与recycleview。我想用折叠工具栏和嵌套滚动来完成一项任务。在那个嵌套的卷轴中,我想使用recycler视图来获取图像

05-15 10:07:37.227 3660-3660/com.example.welcome.dem E/AndroidRuntime: FATAL EXCEPTION: main
                                                                   Process: com.example.welcome.dem, PID: 3660
                                                                   java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.welcome.dem/com.example.welcome.dem.MainActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.constraint.ConstraintLayout
                                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
                                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
                                                                       at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                       at android.os.Looper.loop(Looper.java:154)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:6119)`this is the highlighed error`
                                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
                                                                    Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.constraint.ConstraintLayout
                                                                    Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.constraint.ConstraintLayout
                                                                    Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.constraint.ConstraintLayout" on path: DexPathList[[zip file "/data/app/com.example.welcome.dem-1/base.apk", zip file "/data/app/com.example.welcome.dem-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.welcome.dem-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.welcome.dem-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.welcome.dem-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.welcome.dem-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.welcome.dem-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.welcome.dem-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.welcome.dem-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.welcome.dem-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.welcome.dem-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.welcome.dem-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.welcome.dem-1/lib/x86, /system/lib, /vendor/lib]]
                                                                       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
                                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                                       at android.view.LayoutInflater.createView(LayoutInflater.java:609)
                                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
                                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
                                                                       at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
                                                                       at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                       at com.example.welcome.dem.MainActivity.onCreate(MainActivity.java:19)
                                                                       at android.app.Activity.performCreate(Activity.java:6679)
                                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
                                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
                                                                       at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                       at android.os.Looper.loop(Looper.java:154)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
05-15 10:07:37.227 3660-3660/com.example.welcome.dem E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
主要活动

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

public class MainActivity extends AppCompatActivity {
 RecyclerView recyclerView;
 VendorListAdapter vdAdapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);`issues showing on this line`
    recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    vdAdapter = new VendorListAdapter(this, Data.getData());
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(vdAdapter);

}
}
Data.java

import java.util.ArrayList;`enter code here`
public class Data {
public static ArrayList<VendorList> getData() {
    ArrayList<VendorList> listVendors = new ArrayList<>();
    int[] images = {
            R.drawable.bed1,
            R.drawable.bed2,
            R.drawable.bed3,
            R.drawable.bed4,
            R.drawable.bed5
    };
    String[] vendorName = {"LEE PALACE", "RESIDENCY", "CLARION", "RADISON", "VIJAY PARK"};
    String[] price = {"1000INR", "2000INR", "3000INR", "4000INR", "5000INR"};

    for (int i = 0; i < images.length; i++) {
        VendorList list_Vendor = new VendorList();
        list_Vendor.setImageView(images[i]);
        list_Vendor.setVendor_name(vendorName[i]);
        list_Vendor.setPrice(price[i]);
        listVendors.add(list_Vendor);
    }
    return listVendors;
    }
}
VendorListAdapter.java

import android.support.v7.widget.RecyclerView;`vendorlistadaptor code`
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;

public class VendorListAdapter extends RecyclerView.Adapter<VendorListAdapter.MyViewHolder> {
 List<VendorList> listVendor;


public VendorListAdapter(MainActivity mainActivity, List<VendorList> listVendor) {
    this.listVendor = listVendor;
}

@Override
public VendorListAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View itemView = LayoutInflater.from(parent.getContext())
            .inflate(R.layout.vendor_list_card_view, parent, false);
    return new MyViewHolder(itemView);
}

@Override
public void onBindViewHolder(VendorListAdapter.MyViewHolder holder, int position) {
    VendorList vendorList = listVendor.get(position);

    holder.imageView.setImageResource(vendorList.getImageView());
    holder.vendor_name.setText(vendorList.getVendor_name());
    holder.price.setText(vendorList.getPrice());
}

@Override
public int getItemCount() {
    return listVendor.size();
}

public class MyViewHolder extends RecyclerView.ViewHolder {
    public ImageView imageView;
    public TextView vendor_name, price;

    public MyViewHolder(View itemView) {
        super(itemView);
        imageView = (ImageView) itemView.findViewById(R.id.image_view);
        vendor_name = (TextView) itemView.findViewById(R.id.vendor_name);
        price = (TextView) itemView.findViewById(R.id.vendor_price);
    }
}

}
导入android.support.v7.widget.RecyclerView`卖方适配器代码`
导入android.view.LayoutInflater;
导入android.view.view;
导入android.view.ViewGroup;
导入android.widget.ImageView;
导入android.widget.TextView;
导入java.util.List;
公共类VendorListAdapter扩展了RecyclerView.Adapter{
列出供应商名单;
public VendorListAdapter(主活动主活动,列表供应商){
this.listVendor=listVendor;
}
@凌驾
public VendorListAdapter.MyViewHolder onCreateViewHolder(视图组父级,int-viewType){
View itemView=LayoutInflater.from(parent.getContext())
.充气(R.layout.vendor\u list\u card\u view,父视图,false);
返回新的MyViewHolder(itemView);
}
@凌驾
BindViewHolder上的公共无效(VendorListAdapter.MyViewHolder,int位置){
VendorList VendorList=listVendor.get(位置);
holder.imageView.setImageResource(vendorList.getImageView());
holder.vendor_name.setText(vendorList.getVendor_name());
holder.price.setText(vendorList.getPrice());
}
@凌驾
public int getItemCount(){
返回listVendor.size();
}
公共类MyViewHolder扩展了RecyclerView.ViewHolder{
公共影像视图;
公共文本视图供应商名称、价格;
公共MyViewHolder(查看项目视图){
超级(项目视图);
imageView=(imageView)itemView.findViewById(R.id.image\u视图);
供应商名称=(TextView)itemView.findViewById(R.id.vendor\u名称);
price=(TextView)itemView.findViewById(R.id.vendor\u price);
}
}
}
activity_main.xml

<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.welcome.dem.MainActivity">

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


    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical" />

</RelativeLayout>

</android.support.constraint.ConstraintLayout>

折叠\u供应商\u页面.xml

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

<android.support.design.widget.TabLayout
    android:id="@+id/Vendor_tabLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="@dimen/fourty_dp"
    android:background="@color/black"
    android:minHeight="?attr/actionBarSize"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

</android.support.design.widget.TabLayout>

<android.support.design.widget.CoordinatorLayout xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:fitsSystemWindows="true">


    <android.support.design.widget.AppBarLayout
        android:id="@+id/Vendor_MyAppbar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/two_twenty_five_dp"
        android:fitsSystemWindows="true">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapse_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="@color/colorAccent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <ImageView
                android:id="@+id/bgheader"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fitsSystemWindows="true"
                android:scaleType="fitXY"
                android:src="@drawable/hotel5"
                app:layout_collapseMode="pin" />

            <RelativeLayout
                android:id="@+id/transulent_relative"
                android:layout_width="match_parent"
                android:layout_height="160dp"
                android:layout_marginBottom="@dimen/thirty_five_dp"
                android:layout_marginTop="@dimen/thirty_five_dp"
                android:background="@color/transulent_white"
                android:theme="@android:style/Theme.Translucent">

                <TextView
                    android:id="@+id/wedding_trip"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="@string/wedding_trip"
                    android:textColor="@color/white"
                    android:textSize="@dimen/twenty_five_sp"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/bangalore"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/wedding_trip"
                    android:gravity="center"
                    android:text="@string/bangalore"
                    android:textColor="@color/black"
                    android:textSize="@dimen/eighteen_sp"
                    android:textStyle="bold" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginBottom="@dimen/ten_dp"
                    android:layout_marginEnd="@dimen/thirty_five_dp"
                    android:layout_marginLeft="@dimen/thirty_five_dp"
                    android:layout_marginRight="@dimen/thirty_five_dp"
                    android:layout_marginStart="@dimen/thirty_five_dp"
                    android:layout_marginTop="@dimen/sixty_dp"
                    android:gravity="center"
                    android:orientation="horizontal">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/ten_dp"
                        android:layout_marginStart="@dimen/ten_dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/img1"
                            android:layout_width="wrap_content"
                            android:layout_height="@dimen/sixty_dp"
                            android:layout_gravity="center"
                            android:src="@drawable/vendor_offer" />

                        <TextView
                            android:id="@+id/offers"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:text="@string/offers"
                            android:textColor="@color/white"
                            android:textSize="@dimen/twenty_sp"
                            android:textStyle="bold" />
                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/eighteen_dp"
                        android:layout_marginStart="@dimen/eighteen_dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/img2"
                            android:layout_width="wrap_content"
                            android:layout_height="@dimen/sixty_dp"
                            android:layout_gravity="center"
                            android:src="@drawable/vendor_heart_in" />

                        <TextView
                            android:id="@+id/favorites"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:text="@string/vendor_favorites"
                            android:textColor="@color/white"
                            android:textSize="@dimen/twenty_sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/eighteen_dp"
                        android:layout_marginStart="@dimen/eighteen_dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/img3"
                            android:layout_width="wrap_content"
                            android:layout_height="@dimen/sixty_dp"
                            android:layout_gravity="center"
                            android:src="@drawable/vendor_close" />

                        <TextView
                            android:id="@+id/ignored"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:text="@string/ignored"
                            android:textColor="@color/white"
                            android:textSize="@dimen/twenty_sp"
                            android:textStyle="bold" />
                    </LinearLayout>

                </LinearLayout>

            </RelativeLayout>

            <android.support.v7.widget.Toolbar
                android:id="@+id/Vendor_MyToolbar"
                android:layout_width="match_parent"
                android:layout_height="@dimen/fourty_dp"
                app:layout_collapseMode="pin" />

        </android.support.design.widget.CollapsingToolbarLayout>


    </android.support.design.widget.AppBarLayout>


    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_vertical"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <include
            layout="@layout/vendor_list_card_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </android.support.v4.widget.NestedScrollView>

    <com.github.clans.fab.FloatingActionMenu

        android:id="@+id/fab_menu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_gravity="bottom|end"
        android:layout_marginEnd="@dimen/twenty_dp"
        android:layout_marginRight="@dimen/twenty_dp"
        android:layout_marginTop="@dimen/fourty_five_dp"
        app:menu_fab_label="Floating Action Menu"
        app:menu_fab_size="normal"
        app:menu_labels_colorNormal="@color/ash"
        app:menu_labels_colorPressed="#444"
        app:menu_labels_colorRipple="#66efecec"
        app:menu_labels_cornerRadius="3dp"
        app:menu_labels_ellipsize="none"
        app:menu_labels_textColor="@color/white">

    </com.github.clans.fab.FloatingActionMenu>

</android.support.design.widget.CoordinatorLayout>


</RelativeLayout>

供应商列表\u cardview.xml

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

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="fill_vertical"
    >

<android.support.v7.widget.CardView
    android:id="@+id/card_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/three_dp"
    android:layout_marginLeft="@dimen/three_dp"
    android:layout_marginRight="@dimen/three_dp"
    android:layout_marginStart="@dimen/three_dp"
    android:layout_marginTop="@dimen/three_dp">

    <RelativeLayout
        android:id="@+id/relative_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

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

            <ImageView
                android:id="@+id/image_view"
                android:layout_width="match_parent"
                android:layout_height="@dimen/hundred_seventy_three_dp"
                android:scaleType="fitXY" />
        </LinearLayout>

        <TextView
            android:id="@+id/vendor_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/linear_layout"
            android:layout_marginBottom="@dimen/twenty_dp"

            android:textSize="@dimen/thirty_sp"
            android:textStyle="bold"
            android:textColor="@color/limeGreen"
            android:layout_marginStart="@dimen/ten_dp"
            android:layout_marginLeft="@dimen/ten_dp"/>

        <LinearLayout
            android:id="@+id/linear_layout2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/ten_dp"
            android:layout_marginLeft="@dimen/two_ten_dp"
            android:layout_marginStart="@dimen/two_ten_dp"
            android:layout_marginTop="@dimen/ten_dp"
            android:background="@color/transulent_black"
            android:gravity="right"
            android:orientation="vertical">

            <LinearLayout
                android:id="@+id/linear_layout3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:orientation="horizontal"
                android:layout_marginRight="@dimen/ten_dp"
                android:layout_marginEnd="@dimen/ten_dp">

                <ImageView
                    android:id="@+id/image_vendor_close"
                    android:layout_width="wrap_content"
                    android:layout_height="@dimen/sixty_dp"
                    android:src="@drawable/vendor_close"
                    />

                <ImageView
                    android:id="@+id/image_vendor_white_hrt"
                    android:layout_width="wrap_content"
                    android:layout_height="@dimen/sixty_dp"
                    android:src="@drawable/vendor_white_heart_in"
                    />

            </LinearLayout>

            <RatingBar
                android:id="@+id/rating"
                style="@style/customRatingBar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="fill_horizontal"
                android:rating="3.5"
               />

            <TextView
                android:id="@+id/vendor_price"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/five_dp"
                android:gravity="right"
                android:textColor="@color/white"
                android:textSize="@dimen/twenty_sp"
                android:textStyle="bold"
                android:layout_marginRight="@dimen/ten_dp"
                android:layout_marginEnd="@dimen/ten_dp"/>

            <TextView
                android:id="@+id/vendor_paynow"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/five_dp"
                android:gravity="right"
                android:text="@string/pay_now"
                android:textColor="@color/limeGreen"
                android:textSize="@dimen/twenty_five_sp"
                android:textStyle="bold"
                android:layout_marginRight="@dimen/ten_dp"
                android:layout_marginEnd="@dimen/ten_dp"/>
        </LinearLayout>
    </RelativeLayout>
</android.support.v7.widget.CardView>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>


从xml中删除约束布局并使用相对布局。或者在gradleIt中导入约束库正在工作,感谢@DivyeshPatelNow它正在显示活动\u main和供应商\u列表\u cardwiew.xml。您能给我一个提示,如何将折叠的\u vendor\u page.xml与此连接起来吗?我不明白您想做什么。解释bitI创建的三个xml文件活动main for recycler view和vendor_list_cardview.xml for显示图像多个图像和折叠工具栏的折叠xml文件。我将我的页面设计为第一个折叠工具栏,位于cardview图像下方。现在我只得到了供应商列表xml页面的输出。我没有得到折叠的工具栏xml页面。请从xml中删除约束布局并使用相对布局。或者在gradleIt中导入约束库正在工作,感谢@DivyeshPatelNow它正在显示活动\u main和供应商\u列表\u cardwiew.xml。您能给我一个提示,如何将折叠的\u vendor\u page.xml与此连接起来吗?我不明白您想做什么。解释bitI创建的三个xml文件活动main for recycler view和vendor_list_cardview.xml for显示图像多个图像和折叠工具栏的折叠xml文件。我将我的页面设计为第一个折叠工具栏,位于cardview图像下方。现在我只得到了供应商列表xml页面的输出。我没有看到折叠的工具栏xml页面。
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="fill_vertical"
    >

<android.support.v7.widget.CardView
    android:id="@+id/card_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/three_dp"
    android:layout_marginLeft="@dimen/three_dp"
    android:layout_marginRight="@dimen/three_dp"
    android:layout_marginStart="@dimen/three_dp"
    android:layout_marginTop="@dimen/three_dp">

    <RelativeLayout
        android:id="@+id/relative_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

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

            <ImageView
                android:id="@+id/image_view"
                android:layout_width="match_parent"
                android:layout_height="@dimen/hundred_seventy_three_dp"
                android:scaleType="fitXY" />
        </LinearLayout>

        <TextView
            android:id="@+id/vendor_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/linear_layout"
            android:layout_marginBottom="@dimen/twenty_dp"

            android:textSize="@dimen/thirty_sp"
            android:textStyle="bold"
            android:textColor="@color/limeGreen"
            android:layout_marginStart="@dimen/ten_dp"
            android:layout_marginLeft="@dimen/ten_dp"/>

        <LinearLayout
            android:id="@+id/linear_layout2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/ten_dp"
            android:layout_marginLeft="@dimen/two_ten_dp"
            android:layout_marginStart="@dimen/two_ten_dp"
            android:layout_marginTop="@dimen/ten_dp"
            android:background="@color/transulent_black"
            android:gravity="right"
            android:orientation="vertical">

            <LinearLayout
                android:id="@+id/linear_layout3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:orientation="horizontal"
                android:layout_marginRight="@dimen/ten_dp"
                android:layout_marginEnd="@dimen/ten_dp">

                <ImageView
                    android:id="@+id/image_vendor_close"
                    android:layout_width="wrap_content"
                    android:layout_height="@dimen/sixty_dp"
                    android:src="@drawable/vendor_close"
                    />

                <ImageView
                    android:id="@+id/image_vendor_white_hrt"
                    android:layout_width="wrap_content"
                    android:layout_height="@dimen/sixty_dp"
                    android:src="@drawable/vendor_white_heart_in"
                    />

            </LinearLayout>

            <RatingBar
                android:id="@+id/rating"
                style="@style/customRatingBar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="fill_horizontal"
                android:rating="3.5"
               />

            <TextView
                android:id="@+id/vendor_price"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/five_dp"
                android:gravity="right"
                android:textColor="@color/white"
                android:textSize="@dimen/twenty_sp"
                android:textStyle="bold"
                android:layout_marginRight="@dimen/ten_dp"
                android:layout_marginEnd="@dimen/ten_dp"/>

            <TextView
                android:id="@+id/vendor_paynow"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/five_dp"
                android:gravity="right"
                android:text="@string/pay_now"
                android:textColor="@color/limeGreen"
                android:textSize="@dimen/twenty_five_sp"
                android:textStyle="bold"
                android:layout_marginRight="@dimen/ten_dp"
                android:layout_marginEnd="@dimen/ten_dp"/>
        </LinearLayout>
    </RelativeLayout>
</android.support.v7.widget.CardView>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>