我想中心的所有內容佈局,以中心但這是我有問題:中心的ImageView和TextView的並排
正如你所看到的,我想中心的圖像和文字在他們的父母但想要將圖像留在文字左側。
這裏是佈局代碼:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/app_light_green" >
<ImageView
android:id="@+id/toastImage"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:paddingTop="1dp"
android:src="@drawable/exclamation" />
<TextView
android:id="@+id/toastText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:paddingBottom="3dp"
android:paddingLeft="5dp"
android:paddingRight="3dp"
android:paddingTop="2dp"
android:textColor="@color/app_darker_green"
android:textSize="@dimen/sixteen_sp" />
</RelativeLayout>
看看https://stackoverflow.com/a/39958875/3278589 – Subho