私はこのようなリサイクルのビューがあります。私は2列のグリッドを持っているコードでこれをやっているRecyclerView GridLayoutManager項目match_parent幅
<?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>
:このような
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
とアイテムを:
GridLayoutManager gridLayoutManager = new GridLayoutManager(context, 2, LinearLayoutManager.VERTICAL,false);
_recycler.setLayoutManager(gridLayoutManager);
各アイテムが「match_parent」スペースを利用できるようにしたいと思います。各項目は利用可能な半分のスペースを取る。 width = "match_parent"のアイテムと水平にスクロールする可能性のあるアイテムを持つ方法は?
私はこのような何かをしたい:
screen
|------|
ITEM1 - ITEM2
ITEM3 - ITEM4
水平スクロールと垂直スクロールの両方が必要ですか? – nomag
nop、縦スクロールせずにすべてのコンテンツを表示したいからです。私はちょうど水平スクロールを提供して、 "隠された"アイテムを表示したい。 (なぜなら、各アイテムがマッチする親に表示されているので、他のアイテムを見るためにスクロールする必要があるからです) – deveLost
一度に1アイテムを表示したいのですか?水平にスクロールしますか? –