1

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ptr="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="@color/bg_1"
android:layout_height="match_parent">

    <RelativeLayout
        android:id="@+id/ll_band"
        android:layout_alignParentBottom="true"
        android:background="@color/comment_back_ground"
        android:layout_width="fill_parent"
        android:layout_height="48dp">

        <LinearLayout
            android:focusable="true" android:focusableInTouchMode="true"
            android:layout_width="0px" android:layout_height="0px"/>

        <TextView
            android:text="发送"
            android:layout_marginRight="5dp"
            android:textSize="16sp"
            android:gravity="center"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:id="@+id/tv_send_comment"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@color/text_02"
            />

        <EditText
            android:layout_marginBottom="5dp"
            android:hint="写跟贴"
            android:textColorHint="@color/comment_hint"
            android:textSize="15sp"
            android:id="@+id/et_comment"
            android:layout_toLeftOf="@id/tv_send_comment"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />

    </RelativeLayout>

    <com.handmark.pulltorefresh.library.PullToRefreshListView
        android:id="@+id/ptrlv_comment_List"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@color/bg_1"
        android:layout_above="@id/ll_band"
        android:cacheColorHint="#00000000"
        android:divider="@drawable/line_h"
        android:dividerHeight="2px"
        android:fadingEdge="none"
        android:fastScrollEnabled="false"
        android:footerDividersEnabled="false"
        android:headerDividersEnabled="false"
        android:drawSelectorOnTop="false"
        android:smoothScrollbar="true"
        android:listSelector="@drawable/list_bg"
        ptr:ptrHeaderTextColor="@color/black"
        ptr:ptrAnimationStyle="flip"
        ptr:ptrDrawable="@drawable/arrow_down" >
    </com.handmark.pulltorefresh.library.PullToRefreshListView>

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/png"
        android:layout_above="@id/ll_band"/>

</RelativeLayout>

Above is my layout. whenever EditText gets focused (which will lead android to show soft keyboard), the getView function inside Adapter is called. But I don't want this behavior. can someone help me out? thanks in advance.

  • basically what do you want.. when your keyboard is shown you dont want to the getview to be called ??? – Moubeen Farooq Khan Aug 11 '15 at 05:09
  • @MoubeenFarooqKhan Yes. Now when the keyboard is shown. my listView will go upwards a little bit then come back again. and from log I can see getView is called. And I don't want this. Thanks. – Friends_little_black Aug 11 '15 at 06:03

1 Answers1

0

If your layout automatically shows the keyboard, you could use android:focusableInTouchMode="true" in the root layout to hide keypad initially.And shows only on focus

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ptr="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:focusableInTouchMode="true"
android:layout_height="match_parent">

<EditText
            android:layout_marginBottom="5dp"
            android:hint="写跟贴"
            android:textColorHint="@color/comment_hint"
            android:textSize="15sp"
            android:id="@+id/et_comment"
            android:layout_toLeftOf="@id/tv_send_comment"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
</RelativeLayout>
Arun Shankar
  • 612
  • 1
  • 5
  • 16