我是靠谱客的博主 霸气月亮,最近开发中收集的这篇文章主要介绍Linearlayout中控件靠右/靠下,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

这个是短信界面中根据字数调整大小的对话框:

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
都必须是wrap
android:layout_gravity="right">
<TextView
android:id="@+id/xianshi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_margin="10dp"
android:background="@drawable/corners2"
android:textColor="#FFFFFF" />
</LinearLayout>

一般情况:

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
这两个都必须是match
<ImageView
android:id="@+id/imageView6"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
表示在底部
android:layout_weight="1"
这里必须是1
android:paddingBottom="5dp"
app:srcCompat="@android:drawable/ic_menu_camera" />
</LinearLayout>

最后

以上就是霸气月亮为你收集整理的Linearlayout中控件靠右/靠下的全部内容,希望文章能够帮你解决Linearlayout中控件靠右/靠下所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(56)

评论列表共有 0 条评论

立即
投稿
返回
顶部