Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the datepicker add a calendar in my view?

Tags:


I am starting to learn how to develop on Android. It is pretty straightforward but I'm facing an issue I did not find any mention anywhere...

I have a view :

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"      android:paddingLeft="16dp" android:paddingRight="16dp" android:orientation="vertical">      <EditText         android:id="@+id/editNomProduit"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:ems="10"         android:hint="@string/ht_nom_produit" />        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="wrap_content"      android:paddingLeft="16dp" android:paddingRight="16dp" android:orientation="horizontal">          <TextView             android:id="@+id/labelQuantiteProduitEdit"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="@string/labelQuantiteProduitEdit"             android:textAppearance="?android:attr/textAppearanceMedium" />  <EditText         android:id="@+id/editQuantite"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:inputType="number" />  <Spinner     android:id="@+id/spinnerUnite"     android:layout_width="wrap_content"         android:layout_height="wrap_content"/>      </LinearLayout>     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="wrap_content"      android:paddingLeft="16dp" android:paddingRight="16dp" android:orientation="horizontal">          <TextView             android:id="@+id/labeDateAchatProduitEdit"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="@string/labelDateAchatProduitEdit"             android:textAppearance="?android:attr/textAppearanceMedium" />          <DatePicker             android:id="@+id/dpDateAchatProduit"             android:layout_width="wrap_content"             android:layout_height="wrap_content" />  </LinearLayout>  </LinearLayout> 

Which displayed a datepicker. The thing is that the date picker seems to add a Calendar besides the classic rollers for the date picker (see picture). I don't want this view, juste the roller for the date. Am I usign the date picker in the wrong way or is this the orignal behavior ? Thanks !

Guillaume

Date picker with canlendar

like image 387
Guigui Avatar asked Dec 02 '12 15:12

Guigui


People also ask

How do I change Date Picker Format?

Do one of the following: For a text box control or a date picker control, ensure that the Data type list displays the appropriate data type, and then click Format. For an expression box control, ensure that the Format as list displays the appropriate data type, and then click Format.

How do I change Date Picker Format in Excel?

To change the way that the date is displayed, double-click the date picker, click the Data tab, and then click the Format button. Choose a display format in the Date Format dialog box.

How do I show a Date Picker in access?

Add in a Date Picker in Access!Press F4 to open the Property Sheet. Select the desired date field from the Selection Type dropdown list at the top of the Property Sheet. Select the Format tab on the Property Sheet. In the Show Date Picker field, select For dates.


1 Answers

Add this line to your date picker xml

android:calendarViewShown="false" 

This will remove the Calendar.

like image 73
CocoNess Avatar answered Oct 23 '22 11:10

CocoNess