android - 安卓布局問題
問題描述
我希望一個(gè)dialog里面顯示一個(gè)datePicker和兩個(gè)按鈕,但是顯示不出按鈕,另外流量配額那個(gè)TextView也有點(diǎn)問題,調(diào)了好多次也沒弄明白,我希望他顯示在一行并且豎直居中,下面是顯示效果和布局文件,麻煩大家?guī)兔Ω母模x謝
<?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:我只能說你那個(gè)DatePicker高度都已經(jīng)match_parent了,還指望著下面的Button能顯示啊!!給你個(gè)提示,對(duì)DatePicker用weight屬性:
android:layout_weight=1android:layout_width='match_parent'android:layout_height='0dp'
相關(guān)文章:
1. javascript - 手機(jī)點(diǎn)擊input時(shí),button會(huì)被頂上去?求解決!!!2. 百度地圖api - Android 百度地圖 集成了定位,導(dǎo)航 相互的jar包有沖突?3. python - django 按日歸檔統(tǒng)計(jì)訂單求解4. 網(wǎng)頁爬蟲 - python爬蟲用BeautifulSoup爬取<s>元素并寫入字典,但某些div下沒有這一元素,導(dǎo)致自動(dòng)寫入下一條,如何解決?5. javascript - vue-mint UI - icon在哪里有文檔?6. HTML5禁止img預(yù)覽該怎么解決?7. javascript - vscode alt+shift+f 格式化js代碼,通不過eslint的代碼風(fēng)格檢查怎么辦。。。8. html5 - 表單無法屏蔽自動(dòng)填充 autocomplete=off9. html - 請(qǐng)教一個(gè)前端css問題。10. 請(qǐng)教一個(gè)python字符串處理的問題?
