如果我想在布局中心有一张图片,我可以轻松使用:“垂直居中”和“居中水平居中”。但现在我想要一张照片放在左侧的中心。但我不想使用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
是的。这不行吗? –