我的ImageView
和TextView
未正確對齊。是否因爲我的佈局設置?我想要的是ImageView將父對象左對齊和TextView對齊。Android - ImageView在TableLayout中未正確對齊
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:layout_marginTop="10dp"
android:padding="10dp" >
<ImageView
android:id="@+id/profilePicture"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginRight="8dp"
android:src="@drawable/user_50"
android:gravity="center" ></ImageView>
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Mohammad Nurdin, 26"
android:gravity="center"/>
</TableRow>
<!-- .. -->
</TableLayout>
</ScrollView>
請指點如何解決它。
使用layout_gravity = 「左」 用於IV和layout_gravity = 「右」 用於電視,而不是重力和檢查。請讓我知道它是否有效 – shivamDev 2015-03-03 14:10:39
您可以在表格行內使用相對佈局,然後將父級設置爲左側或您想要的任何內容。 – 2015-03-03 14:11:12
它不起作用 – 2015-03-03 14:11:33