我有一個背景圖像孩子一個相對佈局內:在現在的Android,RelativeLayout的
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/mainBackground"
android:layout_marginTop="14dp"
android:maxLines="1"
android:scrollHorizontally="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="1"
android:textColor="@android:color/black"
android:background="@color/beige"
android:id="@+id/myText"
/>
,我的設備上:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:src="@drawable/game_background_main"
android:id="@+id/mainBackground"
/>
我那麼這個孩子之後引入相對佈局內一個TextView至少,mainBackground圖像被縮放,以便高度與屏幕相同,但寬度略小,所以左側和右側存在間隙。這可以。
問題是myText文本視圖 - 爲什麼它的左側從屏幕的左側開始,而不是指令的mainBackground圖像的左側?
ru想先看看textview,然後看看imageview或imageview和textview – Sumant 2011-03-24 12:45:10