0

I want to have the same field, like Google Fit:

enter image description here

So I add a TextInputLayout like that, but I can't setup the editext for hide cursor, hide keyboard:

<android.support.design.widget.TextInputLayout android:layout_width="0dp" android:layout_weight="0.6" android:layout_height="wrap_content" style="@style/TextInputLayoutStyle"> <android.support.design.widget.TextInputEditText android:id="@+id/date" style="@style/NewWizardItemPlanTitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="none" android:hint="@string/date" /> </android.support.design.widget.TextInputLayout> 

Thank you very much for your support guys!

2
  • isn't that a spinner inside? Commented Oct 4, 2018 at 14:45
  • Google is likely using a custom View to wrap that spinner. Commented Oct 4, 2018 at 14:46

1 Answer 1

1

Add Custom View and adjust as per your needs.!

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:background="@color/white" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="150dp" android:layout_height="50dp" android:layout_margin="8dp" android:gravity="center_vertical" android:background="@drawable/border_btn"> <Spinner android:layout_width="match_parent" android:layout_height="wrap_content"> </Spinner> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Date" android:textStyle="bold" android:paddingLeft="5dp" android:paddingStart="5dp" android:paddingRight="5dp" android:paddingEnd="5dp" android:textColor="#4e8cff" android:background="@color/white" android:layout_marginLeft="20dp" android:layout_marginStart="20dp" android:layout_marginTop="2dp" /> 

border_btn.xml

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="#00000000" /> <stroke android:width="3dp" android:color="#4e8cff" /> <corners android:radius="5dp" /> </shape> 

Output

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.