android - 安卓布局問題
問題描述
我希望一個dialog里面顯示一個datePicker和兩個按鈕,但是顯示不出按鈕,另外流量配額那個TextView也有點問題,調(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:我只能說你那個DatePicker高度都已經(jīng)match_parent了,還指望著下面的Button能顯示啊!!給你個提示,對DatePicker用weight屬性:
android:layout_weight=1android:layout_width='match_parent'android:layout_height='0dp'
相關(guān)文章:
1. docker 下面創(chuàng)建的IMAGE 他們的 ID 一樣?這個是怎么回事????2. 在應(yīng)用配置文件 app.php 中找不到’route_check_cache’配置項3. html按鍵開關(guān)如何提交我想需要的值到數(shù)據(jù)庫4. objective-c - 自定義導(dǎo)航條為類似美團的搜索欄樣式5. ios - vue-cli開發(fā)項目webstrom會在stylus樣式報錯,飆紅,請大神幫忙6. html5 - 用Egret寫的小游戲,怎么分享到微信呢?7. css - BEM 中塊(Block)有木有什么標準 何時決定一個部分提取為塊而不是其父級的元素呢(Element)?~8. css3 - 怎么感覺用 rem 開發(fā)的不多啊9. css - width設(shè)置為100%之后列表無法居中10. python - 在pyqt中做微信的機器人,要在表格中顯示微信好友的名字,卻顯示不出來,怎么解決?
