나는 간단한 액션 바를 가지고 있는데, 그것은 두 개의 ImageButton
과 Button
을 포함하고있다. 문제는 ImageButton
의 이미지가 정확하게 막대의 중앙에 있지 않음입니다. Button
이 없으면 액션 바 자체가 완벽하게 감싸기 때문에 정렬 된 것처럼 보입니다. 그러나 Button
을 소개 할 때 ImageButton
은 막대의 천장에 달라 붙는 것처럼 보입니다.
여기 내 xml 파일동일한 작업 표시 줄에서 ImageButton과 Button을 정렬하는 방법은 무엇입니까?
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0099cc"
tools:context="com.convo.imgfs.FullscreenActivity">
<!-- The primary full-screen view. This can be replaced with whatever view
is needed to present your content, e.g. VideoView, SurfaceView,
TextureView, etc. -->
<ImageView
android:id="@+id/fullscreen_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/bg_image"
android:scaleType = "centerCrop"/>
<!-- This FrameLayout insets its children based on system windows using
android:fitsSystemWindows. -->
<FrameLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout android:id="@+id/fullscreen_content_controls"
style="?metaButtonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:background="@color/black_overlay"
android:orientation="horizontal"
tools:ignore="UselessParent">
<ImageButton
android:id="@+id/likes_button"
android:src="@drawable/likes_imgbutton"
android:background="@android:color/transparent"
android:layout_width="25dp"
android:layout_height="25dp"
android:scaleType="fitCenter"
android:layout_weight="1"/>
<ImageButton
android:id="@+id/comments_button"
android:src="@drawable/comments_imgbutton"
android:background="@android:color/transparent"
android:layout_width="25dp"
android:layout_height="25dp"
android:scaleType="fitCenter"
android:layout_weight="1"/>
<Button
style="?metaButtonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:text="37 comments"
android:id="@+id/show_comments_button"
android:layout_weight="2"/>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Done"
android:id="@+id/done_button"
android:layout_gravity="right|top" />
</FrameLayout>
입니다 그리고 여기에 활동의 Screenshot입니다합니다 ('좋아요'와 '댓글'아이콘 수평 텍스트 "37 코멘트"로 정렬되어야합니다) 내 당신의 XML 코드를 이해에 따라이하여 ImageButton 태그의
이미지를 게시하는 데 최소한 10 명이 필요한 이유는 무엇입니까? –