-4

please let me know if anyone get idea i get text but on click on edittext but i want both without any click i want same view as shown in below photo

enter image description here

      <com.google.android.material.textfield.TextInputLayout
        android:layout_below="@+id/spinnerTextInput"
        android:id="@+id/device_text"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Device Name"
        app:hintTextColor="@color/subText"
        app:boxStrokeColor="@color/colorBlack"
        app:boxStrokeWidthFocused="1dp"
        app:errorEnabled="true"
        android:layout_margin="10dp">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/device_name_edittext"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/shotOn"
            android:textColorHint="@color/subText"
            android:textColor="@color/TitleBlack">

        </com.google.android.material.textfield.TextInputEditText>


    </com.google.android.material.textfield.TextInputLayout>
Sarthak Dhami
  • 330
  • 1
  • 5
  • 14
  • 1
    https://stackoverflow.com/questions/60898946/materialcomponents-textinputlayout-outlinedbox-it-doesnt-work-properly-boxbackg/60910419#60910419 – MMG May 13 '20 at 07:52
  • i want "shot on tag " default as shown Not on clicked on editText or spinner hint shown on above @Gabriele Mariotti – Sarthak Dhami May 13 '20 at 10:23
  • @SarthakDhami in that case just use it as text or as choice in the autocomplete – Gabriele Mariotti May 13 '20 at 10:31
  • @Gabriele Mariotti if we use text and autocomplete then outside boarder not coming at that time just text View coming as shown in picture i want same and i have three in row in one View – Sarthak Dhami May 13 '20 at 10:52
  • @SarthakDhami Did you read again your question? Without details, without code. – Gabriele Mariotti May 13 '20 at 11:15
  • @Gabriele Mariotti sorry for inconvenience can you please give me answer ? i am update my question – Sarthak Dhami May 13 '20 at 12:25
  • @SarthakDhami Just use a `TextInputLayout` with a `Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu` style and an [`AutoCompleteTextView`](https://github.com/material-components/material-components-android/blob/master/docs/components/TextField.md#implementing-an-exposed-dropdown-menu) – Gabriele Mariotti May 13 '20 at 12:33

3 Answers3

0

Set Padding of EditText

android:padding="20dp"
sasikumar
  • 12,540
  • 3
  • 28
  • 48
0

It is called Outlined text field. You can clone this repo material-components-android to see it by yourself enter image description here Here is the style

<com.google.android.material.textfield.TextInputLayout
  style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:layout_margin="4dp"
  android:hint="@string/cat_textfield_label"
  app:counterEnabled="true"
  app:counterMaxLength="10"
  app:errorEnabled="true"
  app:helperText="@string/cat_textfield_outlined_helper_text"
  app:helperTextEnabled="true"
  app:placeholderText="@string/cat_textfield_placeholder_text">
<com.google.android.material.textfield.TextInputEditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
Trung Nguyen
  • 7,442
  • 2
  • 45
  • 87
0

who are giving review please check question and answer then give you opinion Thank you for your response. Here I am submitting Answer of my question

        <RelativeLayout
        android:layout_below="@+id/spinnerTextInput"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp">
        <EditText
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="15dp"
            android:background="@drawable/boarder"
            android:paddingLeft="5dp"
            android:text="input" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="7dp"
            android:background="@color/white"
            android:textColor="@color/TitleBlack"
            android:text="Label" />
    </RelativeLayout>

make one boarder xml in drawable and add below code

  <?xml version="1.0" encoding="UTF-8"?>
  <shape xmlns:android="http://schemas.android.com/apk/res/android">

   <stroke
    android:width="2dp"
    android:color="@color/TitleBlack" />

    <corners android:radius="10dp" />
     </shape>
Sarthak Dhami
  • 330
  • 1
  • 5
  • 14