【问题标题】:how to put textview on top of a datepicker如何将文本视图放在日期选择器之上
【发布时间】:2012-04-25 14:01:01
【问题描述】:

我正在尝试构建一个带有文本视图和日期选择器的表单,例如: |日期:| |日期选择器在这里| 问题是我认为我的代码与开发人员指南“相同”,但它不起作用。它总是像这样结束: |日期:datePickerHere|

代码如下:

    <?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>

【问题讨论】:

    标签: android datepicker textview scrollview android-linearlayout


    【解决方案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">
    

    如果您不指定“android:orientation”标签,线性布局将默认为水平方向。您必须将其指定为垂直才能实现您想要的效果

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多