android - 安卓布局问题
问题描述
我希望一个dialog里面显示一个datePicker和两个按钮,但是显示不出按钮,另外流量配额那个TextView也有点问题,调了好多次也没弄明白,我希望他显示在一行并且竖直居中,下面是显示效果和布局文件,麻烦大家帮忙改改,谢谢

<?xml version='1.0' encoding='utf-8'?> <LinearLayout xmlns:android='http://schemas.android.com/apk/res/android'android:orientation='vertical' android:layout_width='wrap_content'android:layout_height='match_parent'><LinearLayout android:layout_width='wrap_content' android:layout_height='wrap_content' android:orientation='horizontal'> <TextViewandroid:text='流量配额:'android:layout_gravity='center_vertical'android:layout_weight='3'android:layout_width='0dp'android:layout_height='wrap_content' /> <EditTextandroid: android:layout_weight='4'android:layout_width='0dp'android:layout_height='wrap_content'android:ems='10'android:layout_gravity='center'android:inputType='number' /><Spinnerandroid: android:layout_width='wrap_content'android:layout_height='match_parent' /> </LinearLayout> <DatePicker android: android:layout_width='match_parent' android:layout_height='match_parent' /> <Button android: android:layout_width='match_parent' android:layout_height='match_parent' android:layout_gravity='left' android:text='取消'/><Button android: android:layout_width='match_parent' android:layout_height='match_parent' android:layout_gravity='right' android:text='确定'/> </LinearLayout>
问题解答
回答1:我只能说你那个DatePicker高度都已经match_parent了,还指望着下面的Button能显示啊!!给你个提示,对DatePicker用weight属性:
android:layout_weight=1android:layout_width='match_parent'android:layout_height='0dp'
相关文章:
1. javascript - react能够使用什么时间插件2. node.js - 我是一个做前端的,求教如何学习vue,node等js引擎?3. docker api 开发的端口怎么获取?4. 如何解决Centos下Docker服务启动无响应,且输入docker命令无响应?5. 前端 - 类到底该如何去命名 .newsList 这种的命名难道真的不是过度语义化吗?~6. java - 为什么第一个线程已经释放了锁,第二个线程却不行?7. 如何解决docker宿主机无法访问容器中的服务?8. PHP中的$this代表当前的类还是方法?9. sublime-text - sublime text 3中编译python(sublimeREPL),如何仅运行单行/选定部分10. 老师,flex-shrink: 1; 按视频操作,不会自动缩放

网公网安备