1
在GridView中,我顯示了書籍的網格。每本書都有新的,最喜歡的,完成的。這就是例子,我想實現的東西:Android - 如何使一個視圖的中心位於列表項佈局的另一個視圖的右上角
我的佈局有2個ImageViews:1書的封面和1本書狀態圖標(新的,做的最愛)
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/ivCover"
android:layout_width="95dp"
android:layout_height="146dp"
/>
<ImageView
android:layout_width="26dp"
android:layout_height="26dp"
android:src="@drawable/icon_new"
android:layout_alignParentTop="@id/ivCover"
android:layout_alignRight="@id/ivCover"
android:background="@drawable/shape_round_book_status"
android:layout_marginRight="-13dp"
android:layout_marginTop="-13dp"/>
</RelativeLayout>
我發現如何將一個視圖的中心定位在另一個視圖的右上角here。在這個例子中,解決方案是針對一個項目 - 線性佈局。就我而言,我在網格視圖項目的角落放置了狀態圖標。在結果,大多數狀態圖標不可見:
如何使一個視圖的列表項佈局內的另一個視圖的右上角中心?
非常感謝您的回答!這工作!我做了marginTop和marginRight 10dp!並感謝您的建議! –