私はこのようなレイアウトを作成したいと考えています: https://gyazo.com/2a08bcd731fb1cfeb07e72f75bc05e7e これはどのデバイスに適していますか?どのように私はこのようなレイアウトをprogrammすることができますか?
画面は鉱山ですが、問題はすべての画面サイズに適合しないことです。それはこのようになりますいくつかのデバイスでは :ここ https://gyazo.com/84d878061234c25ae872d4ed2491f2f4
は、私はこのレイアウトをpragrammするために使用するコードです:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button1"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_column="0"
android:layout_row="0"
android:text="Button"/>
<Button
android:id="@+id/Button2"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_column="1"
android:layout_row="0"
android:text="Button"/>
<Button
android:id="@+id/Button3"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_column="0"
android:layout_row="1"
android:text="Button"/>
<Button
android:id="@+id/Button4"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_column="1"
android:layout_row="1"
android:text="Button"/>
//and 200 buttons more
</GridLayout>
</ScrollView>
は、どのように私はすべての画面サイズに収まるこのようなレイアウトをプログラムの開発ができますか?重要 がScrollView
カスタムアダプタで 'Gride view'や' RecyclerView'の 'GridAdapter'を検索する –
アクティビティにコードを書くことなくこれを行うことはできますか?私はボタンの配置をしたいだけです – DaFaack
あなたは何を意味するのか分かりませんが、 'ListView'でやったのと同じように' GridAdapter'を使うこともできますし、 'RecyclerView' AFAIKを使って達成することもできます! –