私は今人気の映画を表示するアプリを開発しています。 TMDB APIを使用してこのデータをフェッチします。私はRecyclerViewを使用しています。このRecyclerViewは2列のグリッド内でクリック可能なImageViewを表示します。 これは私が達成したい結果である: an edge to edge grid of all movies私は唯一のハードコーディング値によって達成することができます:RecyclerViewにグリッドを正しく表示する方法は?
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">`
<ImageView
android:layout_width="185dp" <!--HARDCODED VALUES-->
android:layout_height="278dp"<!--HARDCODED VALUES-->
android:contentDescription="@string/movie"
android:id="@+id/rv_image_view" />
</LinearLayout>
私はlayout_width="match_parent"
またはlayout_height="wrap_content"
を使用している場合は、私は非常に奇妙な、歪んだ結果を得ることができます。 Like this one.これをどのように修正する必要がありますか?
重複としてマークしないでください。私はこれを広範囲に捜し、絶対に何も出てこなかった。
あなたがhttps://github.com/rahulpandey/MovieDB/blob/master/を参照することができますapp/src/main/java/com/rahul/movie/db/view/RectangleImageView.javaこのクラス – Rahul