Im using an EditText in Fragment with a textView,Button and ImageView.
My Problem is :
I cant see what im typing when keyboard appears.
My XML code is :
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/background_light"
android:clickable="true">
<!-- TODO: Update blank fragment layout -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="190dp"
android:background="@drawable/header" />
<TextView
android:id="@+id/head"
style="@style/Base.TextAppearance.AppCompat.Large"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="sub heading" />
<android.support.design.widget.TextInputLayout
android:id="@+id/request_til"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/request_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter your Name and Address here"
android:maxLines="10"
android:minLines="6" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/request_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/colorPrimary"
android:text="Button"
android:textColor="@android:color/background_light" />
</RelativeLayout>
</FrameLayout>
ScreenShots :
when Keyboard appears: I cant see what im typing

after typing and keyboard disappears only then i can see what im typed:

Please someone help me to solve me my problem
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.
Use RelativeLayout rather than FrameLayout and You don`t need parent viewgroup for ScrollView I think it should work her we go
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/background_light"
android:clickable="true">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<ImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="190dp"
android:background="@drawable/header" />
<TextView
android:id="@+id/head"
style="@style/Base.TextAppearance.AppCompat.Large"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="sub heading"
android:layout_below="@+id/img" />
<android.support.design.widget.TextInputLayout
android:id="@+id/request_til"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/head">
<EditText
android:id="@+id/request_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter your Name and Address here"
android:maxLines="10"
android:minLines="6" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
</ScrollView>
<Button
android:id="@+id/request_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/colorPrimary"
android:text="Button"
android:textColor="@android:color/background_light"
android:layout_gravity="bottom"/>
</RelativeLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With