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

無法請求Focus a Spinner

Can#39;t manage to requestFocus a Spinner(無法請求Focus a Spinner)
本文介紹了無法請求Focus a Spinner的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我遇到了一個惱人的屏幕問題.屏幕由一堆 Spinner 組成,一個接一個,然后在 Spinner 下方,一個 EditText.

I've got an annoying issue with a screen. The screen consists of a bunch of Spinners one under the other, and then underneath the spinner, an EditText.

問題是當屏幕啟動時,EditText 有焦點,這意味著一些 Spinner 不在屏幕頂部.盡我所能,我無法通過在屏幕 XML 中使用 <requestFocus/> 或在代碼中使用 requestFocus() 使頂部 Spinner 開始聚焦.我試圖做 requestFocus skipping next EditText 建議的事情,如果我正確地遵循了建議,它也不行.

The problem is that when the screen starts, the EditText has focus, meaning that some Spinners are off the top of the screen. Try as I might, I cannot make the top Spinner start focused, either by using <requestFocus/> in the screen XML, or by using requestFocus() in code. I've attempted to do what requestFocus skipping next EditText suggests, and if I'm following the suggestion correctly, it doesn't work either.

要重現該問題,請在 Eclipse 中創建一個新的 Android 項目.main.xml 是

To reproduce the issue, create a new Android project in Eclipse. main.xml is

<?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">
    <Spinner 
        android:id="@+id/spinner"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">   
        <requestFocus />
    </Spinner>
    <EditText  
        android:id="@+id/edittext"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
</LinearLayout>

活動代碼是

package nz.co.kb.testspinner;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;

public class TestSpinner extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.main);
        View view = getLayoutInflater().inflate(R.layout.main, null);
        final View spinner = view.findViewById(R.id.spinner);
        view.post(new Runnable() {
            public void run() {
                spinner.requestFocus();
            }
        });
        setContentView(view);
        spinner.requestFocus();
    }
}

請注意嘗試了多種樣式的 requestFocus.

Note multiple styles of requestFocus attempted.

這是一個平臺錯誤,還是我做錯了什么?

Is this a platform bug, or am I doing something wrong?

謝謝.

推薦答案

來自網上文檔:

如果視圖不可聚焦(isFocusable() 返回 false),或者如果它可聚焦但在設備處于觸摸模式時在觸摸模式下不可聚焦(isFocusableInTouchMode()),則視圖實際上不會獲得焦點.

A view will not actually take focus if it is not focusable (isFocusable() returns false), or if it is focusable and it is not focusable in touch mode (isFocusableInTouchMode()) while the device is in touch mode.

這篇關于無法請求Focus a Spinner的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Cut, copy, paste in android(在android中剪切、復制、粘貼)
android EditText blends into background(android EditText 融入背景)
Change Line Color of EditText - Android(更改 EditText 的線條顏色 - Android)
EditText showing numbers with 2 decimals at all times(EditText 始終顯示帶 2 位小數的數字)
Changing where cursor starts in an expanded EditText(更改光標在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 一级少妇女片 | 久久国产精品72免费观看 | 狠狠综合久久av一区二区老牛 | 午夜影院官网 | 日韩欧美精品 | 欧美一级片a | 成人午夜激情 | 国产精品69毛片高清亚洲 | 日韩1区 | 成人三级网址 | 日韩一区二区三区在线视频 | 亚洲中午字幕 | 久草新在线 | 国产精品欧美日韩 | 91一区二区三区 | 天堂网中文字幕在线观看 | 欧美成人精品二区三区99精品 | 欧美成人视屏 | 国产欧美一区二区三区久久 | 亚洲精品久久久一区二区三区 | 亚洲视频中文字幕 | 国产在线一区观看 | 日本精品免费 | 一区二区三区亚洲 | 一区二区在线看 | 亚洲一区二区在线视频 | 日韩久久精品视频 | 久久久久成人精品免费播放动漫 | 久久久精品网 | 在线观看亚洲精品视频 | 国产在线精品一区二区三区 | 秋霞av国产精品一区 | 国产亚洲区 | 久久久精品一区 | 中文字幕精品视频 | 久久精品国产一区二区三区不卡 | 国产精品色 | 久久一区视频 | 国产黄色大片网站 | .国产精品成人自产拍在线观看6 | 国际精品鲁一鲁一区二区小说 |