Android :如何按父级剪辑视图,如 CSS 溢出:隐藏
2022-09-02 13:43:53
我有以下观点:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/global_legal_gap"
android:clipToPadding="true"
android:clipChildren="true"
android:baselineAligned="false"
android:background="@drawable/post_sound_bg"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="@dimen/post_sound_card_height"
android:layout_height="@dimen/post_sound_card_height">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/album_art"
android:layout_width="@dimen/post_sound_card_height"
android:layout_height="@dimen/post_sound_card_height"
fresco:backgroundImage="@drawable/music_placeholder" />
<RelativeLayout
android:id="@+id/play_icon_control"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:visibility="gone">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_margin="3dp" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout>
如父视图所示,我正在使用 和 ,但这个父视图的子视图仍然突出在它之外。RelativeLayout
android:clipToPadding="true"
android:clipChildren="true"
或者我做对了吗?我如何实现像CSS这样的东西?overflow:hidden