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 - 請教如何獲取百度貼吧新增的兩個加密參數2. javascript - 使用百度文本編輯器ueditor不顯示樣式問題3. javascript - 給某個類添加一個偽類,這個類有click事件,現在我點擊偽類也觸發了click事件4. css - 使用blur()濾鏡為什么有透明的效果5. javascript - 能不能用js給一個div添加一個持續的hover的效果,就像有另一個鼠標一直放在上邊?6. css3 - 關于css的問題,除了倒數第二個td 其他td的寬度都是15%;因為我表格字段數量不確定7. 如何用筆記本上的apache做微信開發的服務器8. docker - MySQL 報錯:Access denied for user ’xxx’@’localhost’9. python的 itchat微信api文檔的 itchat.send如何發信息給指定用戶?10. javascript - autocomplete ajax怎么配置,求教
