0

我试图用textview和datepicker来建立一个窗体,例如: | Date:| | | datePickerHere | 问题是我认为我有与开发者指南“相同”的代码,但它不工作。它总是结束如: |日期:datePickerHere |如何把textview放在日期选择器上

继承人的代码:

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/scrollView1" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" > 

    <LinearLayout android:layout_width="fill_parent" 
     android:layout_height="wrap_content"> 

     <TextView android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textSize="15sp" 
      android:text="@string/data_label"/> 

     <DatePicker 
      android:id="@+id/data" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" /> 
    </LinearLayout> 
</ScrollView> 

回答

1

变化

<LinearLayout android:layout_width="fill_parent" 
     android:layout_height="wrap_content"> 

<LinearLayout android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 

线性布局将默认为水平方向,如果你不指定 “机器人:方向”标签。你必须指定它为垂直,以达到你想要的效果

相关问题