我正在使用包含带有TextView和ImageView的CardView的RecyclerView(每张卡代表一个城市).我在每张卡片上都有一个onClickListener,可以将我带到城市的博物馆列表中.(RecyclerView由ArrayList填充).该列表是由垂直滚动的同一Cardview组成的RecyclerView.
当一个城市只有一个博物馆时,如何在屏幕中央显示独特的CardView?
这是活动xml:
    <?xml version="1.0" encoding="utf-8"?>
 <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="com.bebbo203.mymuseum.MuseumActivity">
    <android.support.v7.widget.RecyclerView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/recyclerViewMuseum"
        android:scrollbars="vertical"
        android:scrollIndicators="none"
        android:gravity="center_horizontal"
        />
</RelativeLayout>
这是RecyclerView xml:
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:baselineAligned="false"
              xmlns:card_view="http://schemas.android.com/apk/res-auto">
    <android.support.v7.widget.CardView
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="150dp"
        android:id="@+id/cardView"
        card_view:cardCornerRadius="2dp"
        card_view:cardUseCompatPadding="true"
        android:gravity="center_horizontal"
        android:animateLayoutChanges="true"
        >
        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <ImageView
                android:layout_width="match_parent"
                android:layout_height="150dp"
                android:id="@+id/imageViewList"
                android:layout_gravity="center_horizontal|top"
                android:adjustViewBounds="true"
                android:scaleType="centerCrop"/>
            <TextView
                android:id="@+id/textViewList"
                android:layout_width="match_parent"
                android:layout_height="150dp"
                android:textSize="40sp"
                android:textIsSelectable="false"
                android:textAlignment="center"
                android:gravity="fill"
                android:textStyle="bold"
                android:layout_weight="1"
                android:layout_gravity="center_horizontal|top"/>
        </FrameLayout>
    </android.support.v7.widget.CardView>
</RelativeLayout>`
谢谢你的帮助.
当我点击只有一个博物馆的Parigi时,我想在屏幕中央显示单个卡片视图
(如果有可能我想从屏幕中心开始,而不是从顶部开始.如果我打开活动时中央卡片视图始终位于中心.例如,在中心翻译NationalGallery另一个的顺序)
我试图将所有项目水平放置在每一行中 RecyclerView
我尝试了很多东西:RelativeLayout作为父亲,然后使用layout_centerInParent,使用基本的android:layout_gravity ="center",尝试添加一些空间元素,使用权重和.... 
item_row.xml
但我没有成功:(
是)我有的

我想要的是

在活动中
recyclerView.setLayoutManager(new GridLayoutManager(this, 3));
item_row.xml
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="4dp"
card_view:cardUseCompatPadding="true">
<!--   Recycler View Item Row   -->
<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical">
    <ImageView
        android:id="@+id/imgThumbnail"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:adjustViewBounds="true"
        android:background="@android:color/black" />
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="item name"
            android:id="@+id/txtName"
            android:layout_margin="5dp"
            android:singleLine="false"
            android:lines="2"
            android:gravity="center" />
        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <TextView
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:id="@+id/txtCategory"
                android:textStyle="italic"
                android:textColor="#496fa9"
                android:text="subtitle"
                android:layout_weight="1"
                android:gravity="center_vertical"
                android:paddingLeft="10dp"
                android:layout_gravity="center" />
            <ImageButton
                android:id="@+id/imageButton"
                android:layout_width="48dp"
                android:layout_height="wrap_content"
                android:background="@android:color/black"
                android:adjustViewBounds="true"
                android:scaleType="fitCenter"
                android:padding="8dp"/> …android android-layout gridlayoutmanager android-recyclerview