Android的RelativeLayout的view的layout_marginBottom不起作用

本文详细阐述了在使用RelativeLayout布局时遇到的view属性不起作用的问题,并提供了解决方案:通过在视图外添加一层布局来解决冲突。文章还介绍了如何在布局中设置view属性以实现预期效果。

当RelativeLayout的view设置了layout_alignParentBottom属性以后,该view的layout_marginBottom会不起作用。或者其他的一些属性不起作用的时候,就需要在该view的外面再加一层layout才起作用。创建一个layout具有一下属性,然后在里面添加view。。

android:id="@+id/gap"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_alignParentBottom="true"

根据以上代码总结这个代码是怎么实现对于view的骨架渲染的,此外有以下下ml代码<io.supercharge.shimmerlayout.ShimmerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" app:shimmer_angle="0" app:shimmer_animation_duration="1200"/>和<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="100dp" android:layout_marginBottom="8dp" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" android:layout_marginTop="8dp" android:background="@android:color/white" android:orientation="horizontal" > <View android:layout_width="84dp" android:layout_height="match_parent" android:layout_marginBottom="16dp" android:layout_marginEnd="8dp" android:layout_marginLeft="16dp" android:layout_marginRight="8dp" android:layout_marginStart="16dp" android:layout_marginTop="16dp" android:background="@color/light_transparent" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="16dp" android:layout_marginEnd="16dp" android:layout_marginLeft="8dp" android:layout_marginRight="16dp" android:layout_marginStart="8dp" android:layout_marginTop="16dp" android:orientation="vertical"> <View android:layout_width="match_parent" android:layout_height="10dp" android:background="@color/light_transparent" /> <View android:layout_width="120dp" android:layout_height="10dp" android:layout_centerVertical="true" android:background="@color/light_transparent" /> <View android:layout_width="match_parent" android:layout_height="10dp" android:layout_alignParentBottom="true" android:background="@color/light_transparent" /> </RelativeLayout> </LinearLayout>
09-04
<View android:id="@+id/client_pie_chart" android:layout_width="@dimen/tpds_all_dp_100" android:layout_height="@dimen/tpds_all_dp_100" android:layout_marginStart="@dimen/tpds_all_dp_32" android:layout_marginTop="@dimen/tpds_all_dp_20" android:layout_marginBottom="@dimen/tpds_all_dp_32" android:focusable="true" android:visibility="visible" android:background="@drawable/skeleton_rounded_background" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/tab" /> <LinearLayout android:id="@+id/recycler" android:layout_width="0dp" android:layout_height="wrap_content" android:orientation="vertical" android:layout_marginStart="@dimen/tpds_all_dp_40" android:layout_marginEnd="@dimen/tpds_all_dp_32" android:visibility="visible" app:layout_constraintBottom_toBottomOf="@+id/client_pie_chart" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/client_pie_chart" app:layout_constraintTop_toBottomOf="@+id/tab" android:gravity="center_vertical" > <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1"> <View android:id="@+id/view1" android:layout_width="40dp" android:layout_height="18dp" android:layout_marginStart="10dp" android:background="@drawable/skeleton_rounded_background" android:layout_alignParentStart="true" /> <View android:id="@+id/view2" android:layout_width="20dp" android:layout_height="18dp" android:background="@drawable/skeleton_rounded_background" android:layout_alignParentEnd="true" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1"> <View android:layout_width="40dp" android:layout_height="18dp" android:layout_marginStart="10dp" android:background="@drawable/skeleton_rounded_background" android:layout_alignParentStart="true" /> <View android:layout_width="20dp" android:layout_height="18dp" android:background="@drawable/skeleton_rounded_background" android:layout_alignParentEnd="true" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1"> <View android:layout_width="40dp" android:layout_height="18dp" android:layout_marginStart="10dp" android:background="@drawable/skeleton_rounded_background" android:layout_alignParentStart="true" /> <View android:layout_width="20dp" android:layout_height="18dp" android:background="@drawable/skeleton_rounded_background" android:layout_alignParentEnd="true" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1"> <View android:layout_width="40dp" android:layout_height="18dp" android:layout_marginStart="10dp" android:background="@drawable/skeleton_rounded_background" android:layout_alignParentStart="true" /> <View android:layout_width="20dp" android:layout_height="20dp" android:background="@drawable/skeleton_rounded_background" android:layout_alignParentEnd="true" /> </RelativeLayout> </LinearLayout>为什么右边那几个没有均匀分布
最新发布
11-14
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值