は私が一番下にリストビューをスクロールしようとすると、それはこのように動作します:あなたのリストビュー、下にスクロール、のEditTextビュー奇妙な挙動が
listview.setSelection(listview.getCount()-1);
(恥グーグル、基本的なことscrollToBottom方法を、私たちは持っていましたこれを達成する他の方法を見つけるために..)
しかし、これは動作しません..それを使用する前にいくつかのテキストを入力.. EditTextビューに。面白い?どういたしまして。私たちは、私が[anyView].performClick();
が、運にしようとしていた、問題は奇妙なと奇妙で見ることができるように
Add element to listview -> scrollToBottom -> you are at the very bottom - works
Add element to listview -> type something in EditView -> scrollToBottom - not works
Add element to listview -> type something in EditView -> click anywhere in screen -> scrollToBottom - works!
..
のEditTextに入力すると、私は、リストビューの責任Androidの開発チームについて考えていますなぜすべてのアイデアはとてもラメです?そして、このバグの回避策を見つける方法。
ありがとうございました! :)
いくつかのコード:
<ListView
android:id="@+id/nativeLog"
android:focusable="false"
android:focusableInTouchMode="false"
android:transcriptMode="normal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="0dp"
android:paddingBottom="10dp"
android:clipToPadding="false"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:cacheColorHint="#00000000"
android:background="@drawable/gray_bg"
android:listSelector="@color/transparent"
android:divider="@null"
android:dividerHeight="0dp"/>
[...]
<EditText
android:id="@+id/boxInterfaceEditbox"
android:scrollHorizontally="false"
android:inputType="textCapSentences|textLongMessage|textMultiLine|textNoSuggestions"
android:singleLine="false"
android:imeOptions="actionSend"
android:layout_width ="0dp"
android:layout_weight="1"
android:layout_height ="wrap_content"
android:layout_marginLeft="5.5dp"
android:layout_marginRight="5.5dp"
android:paddingTop="8.2dp"
android:paddingBottom="8.2dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:minHeight="@dimen/nav_interface_btn_size"
android:maxHeight="90dp"
android:textColor="#bbb"
android:textSize="15.25dp"
android:gravity="top"
android:background="@drawable/nav_boxtextarea"/>
とJava
scrollToBottomRunnable = new Runnable() {
@Override
public void run() {
log.setSelection(log.getCount() -1);
}
};
@ElSajko Refere here:http://coderzpassion.com/android-custom-listview-with-edittext/助けを得るかもしれない –
@JagjitSingh:EditViewは私の場合はlistviewの項目ではありませんが、見てみましょう。どうも。 – ElSajko
私はあなたの編集テキストがフォーカスを取得し、あなたのボタンがクリックに焦点を当てることができないと思うので、最初に画面をタッチして編集テキストからフォーカスを得るようにします –