简体   繁体   中英

How can i put textview inside edittext

In WhatsApp when you reply to a message it shows like this:

这个

I tried more times but I couldn't design layout like the one WhatsApp uses.

You need just inflate that text which is what you want to reply above your EditText view.My xml code is as below

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    android:orientation="vertical" 
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/rl_resend_root_img"
                    android:visibility="visible"
                    android:padding="5dp"
                    android:background="@drawable/background">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Name"
                        android:id="@+id/tv_resend_name"
                        android:textStyle="bold"/>
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/tv_resend_name"
                        android:text=" Photo"
                        android:visibility="visible"
                        android:id="@+id/resend_no_cmnt"
                        android:gravity="center"
                        android:drawableLeft="@drawable/camera"
                        android:layout_marginTop="5dp" />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/tv_resend_name"
                        android:text="what a pic brooo.."
                        android:maxLines="1"
                        android:textSize="14sp"
                        android:visibility="gone"
                        android:id="@+id/resend_cmnt_data"
                        android:gravity="center"
                        android:layout_marginTop="5dp" />
                    <FrameLayout
                        android:layout_width="36dp"
                        android:layout_height="36dp"
                        android:layout_alignParentEnd="true">

            <ImageView
               android:layout_width="match_parent"
               android:layout_height="match_parent"
               android:id="@+id/resend_image"
               android:src="@drawable/henna"/>
                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="top|end"
                    android:background="@drawable/background"
                    android:id="@+id/resend_clear_img"
                    android:src="@drawable/clear"/>
            </FrameLayout>
        </RelativeLayout>

Happy coding

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM