2017-03-06 18 views
-6

このタイプのフォームを設計して実装したいですか?アンドロイドでGoogleカレンダーのようなフォームを設計する方法は?

enter image description here

私はあなたがPercentageRelativeLayoutを使って、それを達成することができますアンドロイド

+0

をあなたがここに依頼する方法を知っていますか? – xFighter

+2

ここでは、他の人にあなたの要件を尋ねることはできません。まず自分で試して、あなたが直面している問題を尋ねます。 – tahsinRupam

+0

そのデザインには特別なものはありません。ちょうどレイアウトのビュー。尋ねることは全くありません。設計上問題がある場合は、その問題を指定してください。 –

答えて

1

に新たなm個という

のために私を助けて。

は、このXMLコードを試してみてください。

<?xml version="1.0" encoding="utf-8"?> 
<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:padding="20dp" 
    android:layout_margin="10dp"> 

    <android.support.percent.PercentRelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/from_layout" 
     android:layout_margin="5dp"> 

     <TextView 
      android:text="FROM" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/textView8" 
      android:textSize="24sp" 
      style="@android:style/Widget.DeviceDefault.Light.TextView" /> 

     <Spinner 
      app:layout_widthPercent="60%" 
      android:layout_height="wrap_content" 
      android:id="@+id/spinner2" 
      android:layout_below="@+id/textView8" 
      android:spinnerMode="dialog" 
      style="@style/Platform.Widget.AppCompat.Spinner" /> 

     <Spinner 
      app:layout_widthPercent="40%" 
      android:layout_height="wrap_content" 
      android:id="@+id/spinner4" 
      android:layout_toRightOf="@+id/spinner2" 
      android:gravity="start" 
      android:layout_below="@+id/textView8" 
      android:spinnerMode="dialog" 
      style="@style/Platform.Widget.AppCompat.Spinner" /> 

    </android.support.percent.PercentRelativeLayout> 

    <android.support.percent.PercentRelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/to_layout" 
     android:layout_below="@+id/from_layout" 
     android:layout_margin="5dp"> 

     <TextView 
      android:text="TO" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/textView9" 
      android:textSize="24sp" 
      style="@android:style/Widget.DeviceDefault.Light.TextView" /> 

     <Spinner 
      app:layout_widthPercent="60%" 
      android:layout_height="wrap_content" 
      android:id="@+id/spinner5" 
      android:layout_below="@+id/textView9" 
      android:spinnerMode="dialog" 
      style="@style/Platform.Widget.AppCompat.Spinner" /> 

     <Spinner 
      app:layout_widthPercent="40%" 
      android:layout_height="wrap_content" 
      android:id="@+id/spinner6" 
      android:layout_below="@+id/textView9" 
      android:layout_toRightOf="@+id/spinner5" 
      android:spinnerMode="dialog" 
      style="@style/Platform.Widget.AppCompat.Spinner" /> 

    </android.support.percent.PercentRelativeLayout> 

    <android.support.percent.PercentRelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/to_layout" 
     android:layout_margin="5dp"> 

     <CheckBox 
      android:text="ALL DAY" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/checkBox" 
      tools:ignore="HardcodedText" 
      style="@style/Widget.AppCompat.CompoundButton.CheckBox" 
      android:textSize="18sp" /> 

     <Spinner 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/spinner3" 
      android:layout_below="@+id/checkBox" 
      android:spinnerMode="dialog" 
      style="@style/Platform.Widget.AppCompat.Spinner" /> 
    </android.support.percent.PercentRelativeLayout> 
</android.support.percent.PercentRelativeLayout> 

あなたはこのようなデザインを取得します:

enter image description here

+0

** thanks sir **しかしdatepickerから日付を取得してデータベースに保存する方法は? –

関連する問題