0

I Want to send button similar to Instagram Comment Section. But when i run the application only Textfield Appear.

Here is My XML

Popup.xml :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:background="@drawable/dialog_bg"
    android:padding="10px">
//Receive the comment from Api
    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/popup_rcv">
    </android.support.v7.widget.RecyclerView>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_gravity="bottom">
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/new_comment_et"
            android:hint="Please enter Comment"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/comment_btn"
            android:text="Submit"
            />
    </LinearLayout>
</LinearLayout>

Thanks in Advance

Ashish
  • 6,791
  • 3
  • 26
  • 48

1 Answers1

2

I Want to send button similar to Instagram Comment Section. But when i run the application only Textfield Appear.

Because your EditText width is match_parent just add some weight in your EditText

Just add android:layout_weight="1" in your EditText

SAMPLE CODE

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:background="@drawable/dialog_bg"
    android:padding="10px">
//Receive the comment from Api
    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/popup_rcv">
    </android.support.v7.widget.RecyclerView>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_gravity="bottom">
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/new_comment_et"
            android:layout_weight="1"
            android:hint="Please enter Comment"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/comment_btn"
            android:text="Submit"
            />
    </LinearLayout>
</LinearLayout>
AskNilesh
  • 67,701
  • 16
  • 123
  • 163