1

以下是Chat Footer,它包含在聊天片段中。理想情況下,用戶應該能夠輸入他的信息併發送。但是,我們甚至無法在編輯文本框內點擊。 Android EditText無法輸入文字

<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> 

下面是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> 

無法編輯/輸入或點擊裏面。 可能是什麼原因?

+0

您是否找到了解決方案? –

回答

0

你必須設置可編輯=真

+0

也做到了。無論是編程方式還是xml。沒有工作。 – Raja

+0

啊我認爲這是一個問題,當你設置它可點擊或touchabke – Mann

0

我認爲問題出在聊天頁腳

嘗試 focusableInTouchMode = 「真」 機器人:可調焦= 「」 真」

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

嘗試它,但沒有奏效。 – Raja