我一直在嘗試成功對齊視圖,以便它們在其他手機上看起來相同,但我無法成功。我只是無法讓它工作。這裏的背景是:無法正確對齊視圖
我想在綠燈區中部一個TextView,而在藍色區域的中部,並在橙色區域的ImageView的。我已經問過這個,我有一個建議使用layout_weight here。但我無法正確計算重量。我怎樣才能做到這一點? layout_weight是否是正確的路線?我如何計算它?
措施:
屏幕的左側和右側(黃色)爲空.. 40像素每..
綠區具有在centrer一個TextView .. 236像素
橙色區域具有一個imageview的在中心.. 44 PX
藍色區具有在中心處一個TextView .. 120 PX
我用於custom_row的XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:orientation="horizontal"
android:layout_height="wrap_content" android:paddingTop="10dip" android:paddingBottom="10dip">
<TextView android:id="@+id/Start_Numbering" android:textSize="19.5dip"
android:layout_width="0dp" android:layout_height="wrap_content"
android:layout_weight="0.3" android:background="@drawable/list_number_bg"
android:gravity="center"
/>
<ImageView android:id="@+id/Start_ImageView"
android:layout_weight="0.1" android:layout_height="fill_parent" android:scaleType="center"
android:layout_width="0dp" android:src="@drawable/list_noaudioavailable"
android:gravity="center"
></ImageView>
<TextView android:id="@+id/Start_Name" android:textColor="#a7e9fe"
android:textSize="25dip" android:layout_width="0dp"
android:layout_weight="0.6"
android:gravity="center" android:background="@drawable/list_name_bg"
android:layout_height="wrap_content" />
告訴我們每個帶的寬度,併發布您嘗試用來定位視圖的佈局。 –