View:layout_weight 权重 (数值越小,权重越大,默认为0)

博客围绕View:layout_weight权重展开,介绍其特点为值越小权重越大,默认值为0 。
       
<com.mediatek.keyguard.Telephony.KeyguardSimPinPukMeView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/res-auto" android:id="@+id/keyguard_sim_pin_puk_me_view" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" androidprv:layout_maxWidth="@dimen/keyguard_security_width" androidprv:layout_maxHeight="@dimen/mtk_keyguard_security_max_height" android:gravity="center_horizontal"> <LinearLayout android:id="@+id/sim_info_message" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_gravity="center_horizontal" android:gravity="center_vertical"> <TextView android:id="@+id/slot_num_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:ellipsize="marquee" android:singleLine="true" android:textDirection = "locale" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="?attr/wallpaperTextColor" android:visibility="gone" /> <ImageView android:id="@+id/keyguard_sim" android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@drawable/ic_lockscreen_sim"/> </LinearLayout> <LinearLayout android:id="@+id/keyguard_bouncer_frame" android:layout_width="match_parent" android:layout_height="0dp" android:orientation="vertical" android:layout_weight="1" android:layoutDirection="ltr" > <RelativeLayout android:id="@+id/row0" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:paddingBottom="16dp" > <com.android.keyguard.PasswordTextView android:id="@+id/simPinPukMeEntry" android:layout_width="@dimen/keyguard_security_width" android:layout_height="match_parent" android:gravity="center" android:layout_centerHorizontal="true" android:layout_marginRight="72dp" androidprv:scaledTextSize="28" /> <com.android.keyguard.NumPadButton android:id="@+id/delete_button" android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center_vertical" android:clickable="true" android:paddingTop="8dip" android:paddingBottom="8dip" android:paddingRight="8dp" android:paddingLeft="24dp" android:contentDescription="@string/keyboardview_keycode_delete" android:layout_alignEnd="@+id/simPinPukMeEntry" android:layout_alignParentRight="true" style="@style/NumPadKey.Delete" /> <View android:id="@+id/divider" android:layout_width="match_parent" android:layout_height="1dp" android:layout_alignParentBottom="true" android:background="#28FFFFFF" /> </RelativeLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal" > <com.android.keyguard.NumPadKey android:id="@+id/key1" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" android:layout_marginEnd="@dimen/mtk_num_pad_key_margin_end" androidprv:textView="@+id/simPinPukMeEntry" androidprv:digit="1" /> <com.android.keyguard.NumPadKey android:id="@+id/key2" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" android:layout_marginEnd="@dimen/mtk_num_pad_key_margin_end" androidprv:textView="@+id/simPinPukMeEntry" androidprv:digit="2" /> <com.android.keyguard.NumPadKey android:id="@+id/key3" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" androidprv:textView="@+id/simPinPukMeEntry" androidprv:digit="3" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal" > <com.android.keyguard.NumPadKey android:id="@+id/key4" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" android:layout_marginEnd="@dimen/mtk_num_pad_key_margin_end" androidprv:textView="@+id/simPinPukMeEntry" androidprv:digit="4" /> <com.android.keyguard.NumPadKey android:id="@+id/key5" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" android:layout_marginEnd="@dimen/mtk_num_pad_key_margin_end" androidprv:textView="@+id/simPinPukMeEntry" androidprv:digit="5" /> <com.android.keyguard.NumPadKey android:id="@+id/key6" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" androidprv:textView="@+id/simPinPukMeEntry" androidprv:digit="6" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:orientation="horizontal" android:layout_weight="1" > <com.android.keyguard.NumPadKey android:id="@+id/key7" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" android:layout_marginEnd="@dimen/mtk_num_pad_key_margin_end" androidprv:textView="@+id/simPinPukMeEntry" androidprv:digit="7" /> <com.android.keyguard.NumPadKey android:id="@+id/key8" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" android:layout_marginEnd="@dimen/mtk_num_pad_key_margin_end" androidprv:textView="@+id/simPinPukMeEntry" androidprv:digit="8" /> <com.android.keyguard.NumPadKey android:id="@+id/key9" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" androidprv:textView="@+id/simPinPukMeEntry" androidprv:digit="9" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal" > <Button android:id="@+id/key_dismiss" style="@style/DismissPadKey" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" android:layout_marginEnd="@dimen/mtk_num_pad_key_margin_end" android:visibility="invisible" android:text="DISMISS" /> <com.android.keyguard.NumPadKey android:id="@+id/key0" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" android:layout_marginEnd="@dimen/mtk_num_pad_key_margin_end" androidprv:textView="@+id/simPinPukMeEntry" androidprv:digit="0" /> <com.android.keyguard.NumPadButton android:id="@+id/key_enter" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" style="@style/NumPadKey.Enter" android:contentDescription="@string/keyboardview_keycode_enter" /> </LinearLayout> </LinearLayout> <include layout="@layout/keyguard_eca" android:id="@+id/keyguard_selector_fade_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_gravity="bottom|center_horizontal" android:gravity="center_horizontal"/> </com.mediatek.keyguard.Telephony.KeyguardSimPinPukMeView> 该界面字键显示不全,分析问题并修改布局
11-28
<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
给你一个布局参考: <?xml version="1.0" encoding="utf-8"?> <!-- 标题部分 --> <TextView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center" android:text="更新成功" android:textSize="24sp" /> <!-- 版本信息部分 --> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1.5" android:orientation="vertical" android:gravity="center_horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="目标更新版本:202506" android:textSize="18sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="当前版本:202506" android:textSize="18sp" /> </LinearLayout> <!-- 对勾图标部分 --> <ImageView android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1.5" android:layout_gravity="center" android:src="@drawable/ic_check" /> <!-- 这里需要替换为实际的对勾图标资源 --> <!-- 提示文字部分 --> <TextView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center" android:text="恭喜您,据更新成功" android:textSize="18sp" /> <!-- 按钮部分 --> <Button android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" android:layout_gravity="center" android:text="我知道了" /> </LinearLayout> 详细的说清楚整个布局的像素框位置和内容
09-06
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值