1

Below is Chat Footer and this is included in a chat fragment. Ideally, user should be able to type his message and send it. However, we are not able to even click inside the edit text box.

<GridLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffffff">

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/backIcon"
        android:src="@drawable/back_button"
        android:background="@null"
        android:layout_row="0"
        android:layout_column="0"
        android:layout_gravity="center|left"
        android:layout_marginLeft="16dp" />

        <EditText
            android:layout_width="300dp"
            android:layout_height="match_parent"
            android:id="@+id/chat_type"
            android:inputType="textMultiLine"
            android:textSize="10dp"
            android:background="@drawable/rounded_corners"
            android:padding="16dp"
            android:textColor="#ff8888"
            android:layout_gravity="top"
            android:enabled="true"
            android:clickable="true"
            android:imeOptions="actionNext"/>

        <ImageButton
            android:id="@+id/chat_send"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/footer_chat_send_normal"
            android:background="@null"
            android:layout_marginLeft="-68dp"
            android:padding="16dp"/>
    </GridLayout>
</RelativeLayout>

Below is fragment_chat.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#fff">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#9700d4">
    <FrameLayout
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center">

        <com.glynk.app.custom.widgets.CircularImageView
            android:id="@+id/fragment_feed_user_picture"
            android:layout_width="65dp"
            android:layout_height="65dp"
            android:padding="50dp"
            android:src="@drawable/animal_cat"
            android:layout_marginTop="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="30dp" />



    </FrameLayout>
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="340dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.8">

        <TextView
            android:id="@+id/fragment_feed_user_name"
            style="@style/WhiteNormal14"
            android:layout_marginTop="25dp"
            android:text="Test"/>

        <TextView
            android:id="@+id/details"
            style="@style/WhiteNormal12"
            android:text="M 38 Sunnyvale"/>
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            <TextView
                android:id="@+id/percentage"
                style="@style/WhiteNormal12"
                android:text="100"/>
            <TextView
                style="@style/WhiteNormal12"
                android:text="%"
                android:layout_marginLeft="20dp"/>
            <TextView
                android:id="@+id/match_topic"
                style="@style/WhiteNormal12"
                android:layout_marginLeft="30dp"
                android:text="in Relationship" />
        </RelativeLayout>

    </LinearLayout>
</LinearLayout>


<LinearLayout
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="400dp">

    <ListView
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/roundcorner_white"
        android:stackFromBottom="true"
        android:transcriptMode="alwaysScroll"
        android:id="@+id/messageTextView" />
</LinearLayout>
<include
    android:id="@+id/messagesFooter"
    android:layout_width="wrap_content"
    android:layout_height="50dp"
    android:layout_marginTop="10dp"
    android:layout_below="@+id/listView"
    layout="@layout/chat_footer"/>

</LinearLayout>

Unable to edit/enter or click inside. What could be the reason?

Raja
  • 442
  • 5
  • 17

4 Answers4

1

You can do it by using

EditText.setEnabled(false);
0

You have to set editable = true

Mann
  • 661
  • 5
  • 9
0

I think problem lies in Chat Footer

Try focusableInTouchMode = "true" android:focusable=""true"

    <?xml version="1.0" encoding="utf-8"?>   
    <GridLayout xmlns:android="http://schemas.android.com/apk/res/android">
       .....
0

It might be useful for others, One of the templates had:

android:descendantFocusability="blocksDescendants"

Another helpful link found just while writing this: Focus on EditText in ListView when block descendants (Android)

Community
  • 1
  • 1
Raja
  • 442
  • 5
  • 17