【发布时间】:2019-11-04 12:22:54
【问题描述】:
我希望我的图像按钮右对齐,但即使gravity="right" 也可以看到它的左对齐。这是我的文件:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TableRow android:layout_height="20dp">
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:backgroundTint="@android:color/transparent"
android:graviy="right"
app:srcCompat="@drawable/ic_person_black_24dp" />
</TableRow>
</TableLayout>
如何正确对齐我的图像按钮?我虽然gravity="right" 会解决问题吗?我尝试了 layout_gravity 和重力。两者都不起作用
【问题讨论】:
标签: android android-layout android-imagebutton androiddesignsupport android-layout-editor