0
안드로이드 응용 프로그램을 만들려고하는데, 문제는 네 개의 ImageButton이 screen의 모든 너비를 덮고 싶다는 것입니다. 제 질문은 내 스크린의 크기가 다른 이미지 크기 여야합니다. 예를 들어, 4 인치 화면이있는 장치에서 각 이미지의 크기는 얼마입니까?여러 화면을 지원하는 Android 애플리케이션?
안드로이드 응용 프로그램을 만들려고하는데, 문제는 네 개의 ImageButton이 screen의 모든 너비를 덮고 싶다는 것입니다. 제 질문은 내 스크린의 크기가 다른 이미지 크기 여야합니다. 예를 들어, 4 인치 화면이있는 장치에서 각 이미지의 크기는 얼마입니까?여러 화면을 지원하는 Android 애플리케이션?
다음과 같이 시도해 볼 수 있습니다. 이렇게하면 화면 너비를 4 개의 이미지보기로 똑같이 나눌 수 있습니다.
<LinearLayout
android:id="@+id/linear1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="4"
android:orientation="horizontal" >
<ImageView
android:id="@+id/img1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/img1" />
<ImageView
android:id="@+id/img2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/img2" />
<ImageView
android:id="@+id/img3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/img3" />
<ImageView
android:id="@+id/img4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/img4" />
</LinearLayout>
.9 이미지는 https://developer.android.com/studio/write/draw9patch.html을 참조하십시오. – Hardik4560
스크린 샷을 보여주고 실제로 원하는 것을 추가하고 지금도 코드를 추가하십시오. –
수평 방향으로 LinearLayout을 사용하고 각 imageView에 대해 가중치를 설정합니다. –