我正在學習Android中的座標系。瞭解Android中的矩形
我想知道爲什麼在右側的X座標值中出現負號。
矩形的總寬度應爲100px。(請參閱圖像ID'圖像')。
矩形的結果是:
Rect(20, 95 - 120, 195)
我XML佈局文件:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_marginLeft="10px"
android:layout_marginTop="10px"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_marginLeft="10px"
android:layout_marginTop="10px"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image"
android:src="@drawable/ic_launcher"
android:layout_width="100px"
android:layout_height="100px"
/>
</LinearLayout>
<ImageView
android:id="@+id/image2"
android:src="@drawable/ic_launcher"
android:layout_width="100px"
android:layout_height="100px"
/>
</LinearLayout>
顯示一些代碼,你如何得到這個'Rect'值? – Bryan