Android - Edittext Not Showing Any Text

Android - EditText not showing any text

The problem was resolved by using android.app.Fragment instead of android.support.v4.app.Fragment. Seems that the support fragment class is buggy when using on tablets with Android 5.1.1.

Text of EditText not visible

The problem is you have set the height of EditText to 20dp. Make the height of EditText to wrap_content and you will see your text/hint.

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">


<include
android:id="@+id/include"
android:layout_width="0dp"
android:layout_height="90dp"
map:layout_constraintEnd_toEndOf="parent"
map:layout_constraintStart_toStartOf="parent"
map:layout_constraintTop_toTopOf="parent" />

<fragment
android:id="@+id/activity_home_map"
android:layout_width="match_parent"
android:layout_height="0dp"
map:layout_constraintBottom_toBottomOf="parent"
map:layout_constraintEnd_toEndOf="parent"
map:layout_constraintStart_toStartOf="parent"
map:layout_constraintTop_toBottomOf="@id/include" />


<android.support.v7.widget.CardView
cardElevation="3dp"
cardUseCompatPadding="true"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="75dp"
android:backgroundTint="@android:color/holo_blue_bright"
map:layout_constraintEnd_toEndOf="parent"
map:layout_constraintStart_toStartOf="parent"
map:layout_constraintTop_toTopOf="@+id/include">


<android.support.constraint.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<View
android:id="@+id/activity_home_view_green"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="20dp"
android:background="@drawable/contact_us"
map:layout_constraintBottom_toBottomOf="@+id/textView3"
map:layout_constraintStart_toStartOf="parent"
map:layout_constraintTop_toTopOf="@+id/textView3" />


<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="20dp"
android:layout_marginTop="8dp"
android:text="My Location"
map:layout_constraintBottom_toTopOf="@+id/guideline3"
map:layout_constraintStart_toEndOf="@+id/activity_home_view_green"
map:layout_constraintTop_toTopOf="parent" />

<View

android:id="@+id/view3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginEnd="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="8dp"
android:background="@android:color/darker_gray"
map:layout_constraintEnd_toEndOf="parent"
map:layout_constraintHorizontal_bias="0.0"
map:layout_constraintStart_toStartOf="parent"
map:layout_constraintTop_toTopOf="@id/guideline3" />


<View
android:id="@+id/activity_home_view_gray"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="20dp"
android:layout_marginTop="8dp"
android:background="@drawable/bg_counter"
map:layout_constraintBottom_toBottomOf="@+id/activity_home_et"
map:layout_constraintStart_toStartOf="parent"
map:layout_constraintTop_toBottomOf="@+id/view3" />

<EditText
android:id="@+id/activity_home_et"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="40dp"
android:hint="Where are you going?"
android:textColor="@android:color/black"
map:layout_constraintBottom_toBottomOf="parent"
map:layout_constraintEnd_toEndOf="parent"
map:layout_constraintStart_toEndOf="@+id/activity_home_view_gray"
map:layout_constraintTop_toTopOf="@+id/guideline3" />

<android.support.constraint.Guideline
android:id="@+id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
map:layout_constraintGuide_begin="50dp" />


</android.support.constraint.ConstraintLayout>

</android.support.v7.widget.CardView>

<pritish.sawant.com.androiddevslopesuberclone.CustomProgressBarInButton.CircularProgressButton
android:id="@+id/activity_home_request_ride_btn"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="30dp"
android:layout_marginStart="30dp"
android:background="@drawable/button_background"
android:gravity="center"
android:text="REQUEST RIDE"
android:textSize="20sp"
map:layout_constraintBottom_toBottomOf="parent"
map:layout_constraintEnd_toEndOf="parent"
map:layout_constraintStart_toStartOf="parent"
tools:fontFamily="@font/changa_one" />

<ImageView
android:id="@+id/activity_home_iv_centerme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:scaleType="centerInside"
map:layout_constraintBottom_toTopOf="@+id/activity_home_request_ride_btn"
map:layout_constraintEnd_toEndOf="parent"
map:srcCompat="@drawable/exit" />
</android.support.constraint.ConstraintLayout>

EditText is not showing hint as well as text when typing

You are using text and hint both together so hint is not visible.

Remove 'text' tag into the EditText :'android:text="Enter password"' and 'tools:text="Enter Password"', if text is set then hint will not display.

<EditText
android:id="@+id/passwordText"
android:layout_width="135dp"
android:layout_height="18dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="46dp"
android:hint="Enter your password."
android:textColor="@android:color/black"
android:textStyle="bold"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/emailText"
/>

Hope it will help..

Edit Text Hint is not visible in android studio design preview but is visible on emulator when app runs

This is usually the case with edittext.
Change the background of the edittext to white and it should display in the layout editor too.
If it doesn't, check the hint text colour.

Android EditText typed text not showing when keyboard appears in Fragment

Though it's very late to reply to this post. I faced the same issue and solved it with

window.setFlags(
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
)

I dynamically set this flag based on the screen requirement.



Related Topics



Leave a reply



Submit