控件高度与宽度设置问题
2017-01-25 14:41
113 查看
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<!--
android:layout_width 用作于设定控件在容器中占用宽度
fill_parent 将控件大小设定为填充父控件
match_parent 同上(推荐) 占满父容器
wrap_content 根据元素中内容的大小设置高宽 适配内容
android:width 只能设置具体的宽度数值,宽度设定与元素本身相关,要生效必须设置android:layout_width
android:height 同上
-->
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:width="200dp"
android:text="@string/hello_world" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<!--
android:layout_width 用作于设定控件在容器中占用宽度
fill_parent 将控件大小设定为填充父控件
match_parent 同上(推荐) 占满父容器
wrap_content 根据元素中内容的大小设置高宽 适配内容
android:width 只能设置具体的宽度数值,宽度设定与元素本身相关,要生效必须设置android:layout_width
android:height 同上
-->
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:width="200dp"
android:text="@string/hello_world" />
</RelativeLayout>
相关文章推荐
- Android布局文件中控件的高度与宽度属性设置
- MFC发送消息设置组合框CComboBox控件的高度和宽度
- android关于代码中动态设置view的高度宽度的问题
- PPT控件Spire.Presentation 教程:在PPT中设置表行高度和列宽度
- span设置宽度和高度无效问题
- IOS UITextView 光标的位置,大小,宽度,高度设置问题
- table元素的宽度/高度设置问题
- 根据屏幕的宽度,动态设置控件高度
- Android自定义TextView根据控件高度和宽度,解决字体适配问题
- android如何动态设置控件的高度和宽度
- Bootstrap改变控件的高度和宽度问题
- Android动态设置控件的宽度和高度
- 父级元素未设置高度和宽度时高度塌陷问题的解决方法
- 设置控件/对话框的宽度和高度
- 在Java代码中设置控件高度和宽度按比例自适应屏幕
- 设置PopWindow显示在某控件之上和无法获取PopWindow高度问题解决方法
- 水滴石穿之子页面的滚动条设置 表格的固定高度宽度问题 复制带格式的文本
- PPT控件Spire.Presentation 教程:在PPT中设置表行高度和列宽度
- 控件在代码设置宽度和高度。
- 用mansard对cell的子控件设置约束,并且自动计算cell高度的问题,ios7警告