다음과 같은 레이아웃을 만들고 싶습니다. https://gyazo.com/2a08bcd731fb1cfeb07e72f75bc05e7e 모든 장치에 맞는 것은 무엇입니까?어떻게 이렇게 레이아웃을 프로그래밍 할 수 있습니까?
화면은 내 것이지만 모든 화면 크기에 맞지 않는 문제가 있습니다.
<?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>
어떻게 모든 화면 크기에 맞는이 같은 레이아웃을 programm 수 있습니다 여기에 https://gyazo.com/84d878061234c25ae872d4ed2491f2f4
을 나는이 레이아웃을 pragramm하는 데 사용되는 코드는 다음과 같습니다 일부 장치에 그것은 다음과 같습니다? 중요 마음에 온있는 ScrollView
사용자 정의 어댑터를 사용하여'Gride view' 또는'RecyclerView'의'GridAdapter'를 검색하십시오. –
활동에 코드를 작성하지 않고도 가능합니까? 버튼의 배열 만 필요합니다. – DaFaack
당신이 무엇을 의미하는지 확신 할 수 없지만'ListView'에서하는 것과 같이'GridAdapter'를 사용할 수 있으며'RecyclerView' AFAIK를 사용하여 얻을 수 있습니다! –