开发者社区> 问答> 正文

关于android简单UI问题!

android:layout_width="match_parent"
 android:layout_height="match_parent" 
 android:orientation="vertical"
 >
 android:layout_width="match_parent"
 android:layout_height="0dp"
 android:layout_weight="1"
 android:divider="#0000" >

    <EditText
    android:id="@+id/input_text"
    android:layout_width="0dp"   /*这行错了,错误说明:this will make the view invisible, probably intended for layout_height*/
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:hint="Type somthing here"
    android:maxLines="2" />
    <Button
    android:id="@+id/send"
    android:layout_width="wrap_content"     
    android:layout_height="wrap_content"
    android:text="Send" />

展开
收起
爵霸 2016-03-18 14:46:27 2150 0
3 条回答
写回答
取消 提交回答
  • 1楼正解,垂直布局且设置了android:layout_weight,得设置高度为0dp,而不是宽度

    2019-07-17 19:06:43
    赞同 展开评论 打赏
  • 都提示你了,width和height弄反了吧。你是vertical属性。

    2019-07-17 19:06:43
    赞同 展开评论 打赏
  • 你设置他的宽为0dp,你见过宽为0的视图吗?所以系统提示你:这样设置将使控件不显示(invisible)。宽度和高度都是不能设置为0的。

    2019-07-17 19:06:42
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
使用TensorFlow搭建智能开发系统自劢生成App UI代码 立即下载
Fusion Design - 企业级UI解决方案揭秘 立即下载
使用TensorFlow搭建智能开发系统自动生成App UI 立即下载