小编Har*_*ngh的帖子

React Navigation:“导航”对象尚未初始化

我正在通过 https://reactnavigation.org/docs/en/upgrading-from-4.x.htmlhttps://reactnavigation.org/docs/en/compatibility.html将 React Navigation 库从 4.xx 升级到 5 。

我收到错误:

NavigationDebug Error:  Error: The 'navigation' object hasn't been initialized yet. This might happen if you don't have a navigator mounted, or if the navigator hasn't finished mounting. You can ensure that all navigators have mounted after the callback to 'useEffect' is called in your root component. See https://reactnavigation.org/docs/en/navigating-without-navigation-prop.html#handling-initialization for more details.
    at dispatch (BaseNavigationContainer.tsx:202)
    at Object.acc.<computed> [as navigate] (BaseNavigationContainer.tsx:245)
    at Object.navigate (NavigationService.ts:20)
    at SplashScreen.redirectUser (splash-screen.tsx:234)
    at SplashScreen.proxiedMethod …
Run Code Online (Sandbox Code Playgroud)

react-native react-navigation

7
推荐指数
1
解决办法
1万
查看次数

单击 EditText 打开微调器

很抱歉打扰你们,但我一直在努力让这个工作正常进行。

我想要它做什么:

EditText 显示提示。

用户单击 EditText,打开微调器并选择他们的性别。然后将其转换为字符串并放入 EditText(gender) 中


它实际上在做什么: 在用户单击它之前,“男性”微调器中的第一个元素已经放入我的 EditText 中。(我从未看到我的提示:“性别”)......并且微调器不会当我尝试单击 EditText(性别)时完全打开

这是怎么回事?

我的代码:

    private Spinner sexSpinner;
    String[] arrayForSpinner = {"Male", "Female"};


    //Inside OnCreate method:
    sexSpinner = (Spinner)findViewById(R.id.spinner);
    adapter = new ArrayAdapter<String>(this, R.layout.spinner_row, arrayForSpinner);
    sexSpinner.setAdapter(adapter);


sexSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view,int position, long id) {
            gender.setText(sexSpinner.getSelectedItem().toString());

        }

gender.setOnFocusChangeListener(new View.OnFocusChangeListener() {

        @Override
        public void onFocusChange(View arg0, boolean hasFocus) {
            // TODO Auto-generated method stub
            if(hasFocus){
                sexSpinner.performClick();
            }
        }
    });
Run Code Online (Sandbox Code Playgroud)

布局:

<EditText
        android:layout_width="75dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="12dp"
        android:focusable="false"
        android:longClickable="false" …
Run Code Online (Sandbox Code Playgroud)

android spinner android-spinner

4
推荐指数
1
解决办法
1万
查看次数

EditText上的KeyListener:Android

我在我的应用程序中有一个editText,我想在用户使用(空格)时运行一些代码.所以,请给我一些关于如何做到这一点的想法.

android android-edittext

2
推荐指数
1
解决办法
7287
查看次数

如何发送包含空格的JSON查询?

我在Link中使用Volley Library填充ListView

"http://192.168.***.***/allquestions/prev_ans.php/?number="+phone_number+"&&query="+query"
Run Code Online (Sandbox Code Playgroud)

假设,用于查询"问题改变"的Json数组是

[{"Name":"AAAAA","Id":"101010101","ques":"question change","Type":"class1","relatedFields":"Eduation","Name":"hshsusu","ans":"new answer 1","replyDate":"2015-09-14","replyTime":"21:05:39"}]
Run Code Online (Sandbox Code Playgroud)

查询"newquestionforcrop"的JSON数组是

[{"Name":"AAAAA","Id":"101010101","ques":"question change","Type":"class1","relatedFields":"Eduation","Name":"hshsusu","ans":"new answer 1","replyDate":"2015-09-14","replyTime":"21:05:39"}]
Run Code Online (Sandbox Code Playgroud)

问题是,当我的查询之间没有空格时,它只填充列表.

我该如何解决这个问题?

android android-volley

1
推荐指数
1
解决办法
1021
查看次数