辽宁智能网站建设价位,网站建设相关的博客有哪些,成都开发小程序的公司,seo优化网站模板一般我们要实现去下图一的效果很简单#xff1a;两个EditText就搞定效果图一#xff1a;但是我们想让第二个EditText撑满剩余空间怎么做#xff1f;如效果图二效果图二#xff1a;解决#xff1a;使用了ScrollView嵌套LinearLayout#xff0c;将ScrollView中android:fill… 一般我们要实现去下图一的效果很简单 两个EditText就搞定 效果图一 但是我们想让第二个EditText撑满剩余空间怎么做如效果图二 效果图二 解决 使用了ScrollView嵌套LinearLayout将ScrollView中android:fillViewport设置为true。 分析 当ScrollView里的元素想填满ScrollView时使用fill_parent是不管用的必需为ScrollView设置android:fillViewporttrue。 当ScrollView没有fillVeewport“true”时, 里面的元素(比如LinearLayout)会按照wrap_content来计算(不论它是否设了fill_parent),而如果 LinearLayout的元素设置了fill_parent,那么也是不管用的因为LinearLayout依赖里面的元素而里面的元素又依赖 LinearLayout,这样自相矛盾.所以里面元素设置了fill_parent也会当做wrap_content来计算. 来源 http://blog.sina.com.cn/s/blog_6cf2ea6a0102v61f.html 代码如下注释了常用的EditText属性 ScrollViewandroid:layout_widthmatch_parentandroid:layout_height0dpandroid:layout_weight1android:fillViewporttrue //*******************关键处********LinearLayoutandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationverticalEditTextandroid:idid/edit_titleandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:layout_gravitycenter|leftandroid:layout_marginLeft16dpandroid:layout_marginRight16dpandroid:backgroundnull //控件背景这里没有指透明android:ellipsizeend //自动隐藏尾部溢出数据一般用于文字内容过长一行无法全部显示时android:hint添加标题android:paddingBottom10dpandroid:paddingTop10dpandroid:singleLinetrue //强制输入的内容在单行android:textColorHint#bfbfbf /LinearLayoutandroid:layout_widthmatch_parentandroid:layout_height2dpandroid:layout_marginLeft10dpandroid:layout_marginRight10dpandroid:backgrounddrawable/dotted_lineandroid:layerTypesoftware /RelativeLayoutandroid:layout_widthmatch_parentandroid:layout_height0dpandroid:layout_weight1EditTextandroid:idid/edit_contentandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:layout_marginLeft16dpandroid:layout_marginRight16dpandroid:layout_marginTop16dpandroid:gravityleft|top //输入时光标在左上角android:hint内容android:lineSpacingExtra4.6dp //设置行间距android:scrollbarsvertical // 设置滚动条显示android:textColorHint#bfbfbfandroid:textSize16sp //RelativeLayout!--android:backgroundnull //去掉EditView的边框android:inputTypetextMultiLine //可以显示多行android:minLines6 // 设置文本的最小行数--/LinearLayout/ScrollView转载于:https://www.cnblogs.com/yjing/p/5314938.html