我:變化的ImageView重力的RelativeLayout代碼
<ImageView
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:contentDescription="@string/logo"
android:onClick="LogoAnimate"
android:src="@drawable/logo" />
我需要改變的:
android: layout_centerHorizontal = "true"
android: layout_centerVertical = "true"
到:
android: layout_alignParentBottom = "true"
android: layout_alignParentLeft = "true"
我怎樣才能在實現這個碼?
其實所有4'params.addRule'行代碼是錯誤的。正確的語法是'public void addRule(int verb,int anchor)',但這可用於對齊ID設置爲錨點的某個對象。對於這個片段只有左參數就足夠了。此外,沒有'RelativeLayout.TRUE'和'RelativeLayout.FALSE'常量存在。 – Stan