久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

停止 ScrollView 將焦點設置在 EditText

Stop ScrollView from setting focus on EditText(停止 ScrollView 將焦點設置在 EditText)
本文介紹了停止 ScrollView 將焦點設置在 EditText的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

Android 的 ScrollView(當滾動或甩動時)喜歡在 EditText 是其中一個子項時設置它的焦點.當您滾動然后釋放時會發生這種情況.有沒有辦法阻止這種行為?我已經嘗試了幾乎所有我能想到的以及我在 StackOverflow 上讀到的所有內容.沒有什么對我有用.下面是一個示例布局,如果您想對其進行測試.我迫切地想要阻止這種愚蠢的行為.

Android's ScrollView (when scrolled or fling'd) likes to set the focus of an EditText when it's one of it's children. It happens when you scroll and then release. Is there anyway to stop this behavior? I've tried nearly everything I can think of and everything I've read on StackOverflow. Nothing has worked for me. Below is an example layout If you'd like to test it out. I'm desperate to stop this dumb behavior.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<ScrollView 
    android:id="@+id/scrollView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

<LinearLayout 
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginRight="50dp"
    android:focusable="true"
    android:focusableInTouchMode="true"
    >

    <EditText 
        android:layout_width="fill_parent" 
        android:layout_height="100dp" 
        android:text="TestApp 1"
        />


    <Button 
        android:id="@+id/btn"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="TestApp 1"
        />

    <Button 
        android:id="@+id/btn"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="TestApp 1"
        />

    <Button 
        android:id="@+id/btn"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="TestApp 1"
        />

    <EditText 
        android:layout_width="fill_parent" 
        android:layout_height="100dp" 
        android:text="Bleh...."
        />

    <Button 
        android:id="@+id/btn"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="TestApp 1"
        />
    <EditText 
        android:layout_width="fill_parent" 
        android:layout_height="100dp" 
        android:text="TestApp 1"
        />


    <Button 
        android:id="@+id/btn"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="TestApp 1"
        />

    <Button 
        android:id="@+id/btn"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="MeeEEEEEEEEEEEEE"
        />

    <Button 
        android:id="@+id/btn"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="TestApp 1"
        />



</LinearLayout>
</ScrollView>

</LinearLayout>

推薦答案

這行得通.不確定這是否是最好的解決方案.

This works. Not sure if it's the best solution or not.

// SCROLL VIEW HACK
    // BOGUS
    ScrollView view = (ScrollView)findViewById(R.id.scrollView);
    view.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            v.requestFocusFromTouch();
            return false;
        }
    });

這篇關于停止 ScrollView 將焦點設置在 EditText的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

EditText: Disable Paste/Replace menu pop-up on Text Selection Handler click event(EditText:禁用文本選擇處理程序單擊事件上的粘貼/替換菜單彈出)
Multiline EditText with Done SoftInput Action Label on 2.3(2.3 上帶有完成 SoftInput 操作標簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測向左或向右滑動?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉對話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設置為僅接受 Android 中的數值?)
主站蜘蛛池模板: 亚洲精品久久久久久国产精华液 | 国产日韩欧美精品 | 欧美一级片在线看 | 美女激情av | 91视频在线观看 | 亚洲国产情侣自拍 | 亚洲精品乱码久久久久久按摩 | 欧美日韩一区二区视频在线观看 | www精品美女久久久tv | 亚洲成av人影片在线观看 | 国产成人在线观看免费 | 99久久99| 日韩一区二区三区在线观看视频 | 婷婷丁香综合网 | 天天干天天爱天天操 | 在线成人免费观看 | 午夜私人影院 | 欧美日韩三级 | 亚洲欧美日韩精品久久亚洲区 | 日本精品一区二区三区在线观看视频 | 国产视频久久久 | 毛片一区二区三区 | 国产亚洲精品精品国产亚洲综合 | 国产成人免费视频网站高清观看视频 | 精品国产不卡一区二区三区 | 婷婷丁香综合网 | www.久| 第四色播日韩第一页 | 精品久久久久久久久久久久 | 国产精品一区在线播放 | 日韩一区二区在线播放 | 性色的免费视频 | www.日本在线播放 | 精品欧美一区二区精品久久久 | 国产在线一区二 | 拍真实国产伦偷精品 | 亚洲综合国产精品 | 欧美一区二区三区在线看 | 九九九久久国产免费 | 日韩av免费看 | 亚洲精品一区二区网址 |