【发布时间】:2018-11-23 23:51:40
【问题描述】:
我的看法如下:
<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?
【问题讨论】:
-
你试过 adjustViewBounds = "true" 吗?
-
@harshjain `adjustViewBounds` 用于图像,此外,它甚至不是这个,而是纵横比。
-
代码中没有
android:clipToPadding。你能张贴你想要的草图吗? -
@TadijaBagarić 代码只是被格式错误的代码删掉了,请参阅编辑。
-
您是否尝试将 android:layout_height 设置为
match_parent?
标签: java android css xml android-view