현재 화면 높이의 절반 만 차지하는 레이아웃에 4 ImageButton
이 있습니다. ImageButton
을 레이아웃에 고르게 배치하고 싶습니다.레이아웃에서 ImageButton을 균등하게 정렬하는 방법
문제는, 1 :
이 이후 여기에, 작동<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@mipmap/feed_button"
android:background="@android:color/transparent"
android:layout_weight="1" />
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@mipmap/feed_button"
android:background="@android:color/transparent"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:orientation="horizontal">
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@mipmap/feed_button"
android:background="@android:color/transparent"
android:layout_weight="1" />
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@mipmap/feed_button"
android:background="@android:color/transparent"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
는 결과이다 : 나는 각 버튼 아래에 텍스트를 추가하고 싶습니다 내가 아니라고 여기에 내가 무엇을 가지고 이것이 어떻게 작동 할 것이며, 2 : 버튼의 일부인 것처럼, 의 오른쪽과 왼쪽에있는 흰 반점이 활성화되어 있습니다. 이 작업을 수행하는 더 좋은 방법이 있습니까?
FrameLayout 내에 TextView와 함께 ImageButton을 넣을 수 있습니다. – user5195185
버튼이기 때문에 "This are active"입니다. 특정 크기의 배경 이미지와 layout_weight = "1"로 "0dp"를 ImageButtons에 설정했습니다 (이는 "지능적으로"확장됩니다). 버튼이나 래퍼에 "wrap_content"를 넣고 여백을 사용하여 작업 할 수 있습니다. – user5195185