<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
让Button自适应大小,EditText占满剩余部分(权重小的先占有)
本文介绍了一种使用LinearLayout实现按钮自适应大小及EditText填充剩余空间的方法。通过设置权重属性,使得界面元素可以根据屏幕尺寸灵活调整其大小,提升用户体验。
5736

被折叠的 条评论
为什么被折叠?



