如果我想在佈局中心有一張圖片,我可以輕鬆使用:「垂直居中」和「居中水平居中」。但現在我想要一張照片放在左側的中心。但我不想使用marginLeft = .. dp。我想在沒有DP的情況下工作。是否有像「垂直居中」等的可能性?這是帶有dp值的代碼。我可以用什麼來代替MarginLeft「38dp」?Eclipse Android佈局:沒有dp值?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerInParent="true"
android:layout_marginLeft="41dp"
android:src="@drawable/rosezwei" />
</RelativeLayout>
'android:layout_centerInParent =「true」'? –
你的意思是像上面編輯過的帖子? – Jannis
是的。這不行嗎? –