2012-01-04 97 views
0

我想要的圖像放置到我的列表極右和按 http://developer.android.com/reference/android/widget/LinearLayout.html#attr_android:gravity 我試圖做字符串類型不允許(在「重力」,值爲「結束」)

<ImageView 
    android:id="@+id/list_now_playing" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:gravity="end" 
    > 
</ImageView> 

,但我出現以上錯誤。 請建議解決方案enter image description here

+0

您正在使用哪個Android版本? – MKJParekh 2012-01-04 11:28:23

+0

使用FILL_PARENT您的TextView或layout_weight = 1 – 2012-01-04 11:46:05

回答

4

屬性值end在Android 4.0(ICS)中可用,但不低於此值。

而第二件事來設置,你可能需要的ImageView HEIGH /寬度設置爲fill_parent

編輯

則另闢蹊徑,它RelativeLayout移動到最右邊取父爲ImageView集合android:layout_alignParentRight="true"android:layout_centerVertical="true"

+0

是怪人你對這個屬性在Android 4.0的 – 2012-01-04 11:29:59

+0

工作,我這樣做 的android:layout_width = 「FILL_PARENT」 機器人:layout_height = 「FILL_PARENT」 機器人:layout_gravity = 「右」 圖像移動到右側,但不是最後.. – shankey 2012-01-04 11:31:42

+0

@shankey然後將其移動到極端右側將'RelativeLayout'作爲**行**和'ImageView'的集合'android:layout_alignParentRight =「true 「'和'android:layout_centerVertical =」true「' – MKJParekh 2012-01-04 11:40:49

相關問題