私がしようとしているのは、このようなものです。デバイスがあるスクロールビュー内の線形レイアウトの重さ
画像1
どんなに。画面上に4行表示する必要があります。後で他の行を表示するにはスクロールしてください。
これを達成するために真の直線レイアウト重量を使用していますが、これを達成しようとしていません。私はより多くの行
画像を追加するときに私は、このような画面を与える2以下
画像として画面を提供しますが、より多くの行を追加すると、画像に2ビューを提供し、私のレイアウトXMLがある
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/lightGray"
android:orientation="vertical">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="1dp"
android:weightSum="4"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="3">
<ImageView
android:id="@+id/abulation"
style="@style/icon"
android:background="@drawable/wudu_96" />
<ImageButton
android:id="@+id/masjid"
style="@style/icon"
android:background="@drawable/masjid_96" />
<ImageView
android:id="@+id/restroom"
style="@style/icon"
android:background="@drawable/restroom_96" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="3">
<ImageView
android:id="@+id/dressing"
style="@style/icon"
android:background="@drawable/dressing_96" />
<ImageButton
style="@style/icon"
android:background="@drawable/icon_selector"
android:scaleType="fitXY" />
<ImageButton
android:id="@+id/Favourite"
style="@style/icon"
android:background="@drawable/favourite_96"
android:onClick="random"
android:scaleType="fitXY" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="3">
<ImageView
style="@style/icon"
android:background="@drawable/fear_96" />
<ImageView
style="@style/icon"
android:background="@drawable/fear_96" />
<ImageView
style="@style/icon"
android:background="@drawable/fear_96" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="3">
<ImageView
style="@style/icon"
android:background="@drawable/fear_96" />
<ImageView
style="@style/icon"
android:background="@drawable/fear_96" />
<ImageView
style="@style/icon"
android:background="@drawable/fear_96" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
私はこれを達成するために間違ったことをしていることを知っています。どうか私は私が望むビューを得ることができます助けてください。
あなたがグリッドにリサイクルビューを使用していない理由は?私はこれを達成するための良い方法だと思います –
最初のlinearLayout(android:weightSum = "1.0")と内側のもの(android:layout_width = "0dp" android:layout_weight = "0.25" - それはあなたに4つの等しい行を与えるかどうか参照してください – Tasos
これらのカテゴリは静的ですか? – Nidhi