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
<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>
Set Padding of EditText
android:padding="20dp"
It is called Outlined text field . You can clone this repo material-components-android to see it by yourself 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>
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.