我的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