我有这样的回收观点:RecyclerView GridLayoutManager项目match_parent宽度
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
和项目是这样的:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="100dp"
android:layout_height="70dp"
android:scaleType="fitCenter"
android:layout_margin="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:linksClickable="true" />
</LinearLayout>
我在代码中这样做是为了有一个2列的网格:
GridLayoutManager gridLayoutManager = new GridLayoutManager(context, 2, LinearLayoutManager.VERTICAL,false);
_recycler.setLayoutManager(gridLayoutManager);
我希望每个项目都有可用的“match_parent”空间,事实并非如此!每个项目占用一半的空间。如何做宽度=“match_parent”的项目和水平滚动的可能性?水平
screen
|------|
ITEM1 - ITEM2
ITEM3 - ITEM4
你想要水平和垂直滚动? – nomag
nop,因为我想显示所有没有垂直滚动的内容。我只是想提供水平滚动显示项目“隐藏”。 (因为如果每个项目都显示在匹配父项中,必须滚动查看其他项) – deveLost
因此,哟要一次显示一个项目?并水平滚动? –