小编wil*_*ove的帖子

如何避免在Android的EditText中执行onTextChanged

我怎样才能避免代码行:

((EditText) findViewById(R.id.MyEditText)).setText("Hello");
Run Code Online (Sandbox Code Playgroud)

会在这里引发一个事件:

((EditText) findViewById(R.id.MyEditText)).addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start,
    int before, int count) {
// HERE
}

@Override
public void beforeTextChanged(CharSequence s, int start,
    int count, int after) {
}

@Override
public void afterTextChanged(Editable s) {
}
});
Run Code Online (Sandbox Code Playgroud)

我想知道是否有任何方法可以禁止onTextChanged的执行,因为我注意到在选择AutoCompleteTextView的下拉结果的情况下(没有执行onTextChanged!).

我不是在寻找像"如果你好无所事事"这样的解决方法......

android android-edittext

23
推荐指数
3
解决办法
2万
查看次数

Android资料设计NestedScrollView/CollapsingToolbarLayout打开键盘的奇怪行为

我试图使用漂亮的cheesesquare项目在android中实现一个材质可滚动的表单

https://github.com/chrisbanes/cheesesquare

但是当我尝试将一个EditText添加到NestedScrollView时,当keybord打开时,工具栏似乎取消固定(在没有输入的情况下没有按预期工作).

这是我的布局

    <?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2015 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ …
Run Code Online (Sandbox Code Playgroud)

android material-design android-collapsingtoolbarlayout

8
推荐指数
2
解决办法
2248
查看次数

谷歌自定义搜索REST结果数量(num字段)

我正试图弄清楚如何强制谷歌自定义搜索每页给我20个结果.我尝试将此REST请求配置为我的新自定义搜索引擎:标准版:免费,结果页面上需要广告.

https://www.googleapis.com/customsearch/v1?key=AIzaSyCgGuZie_Xo-hOECNXOTKp5Yk7deryqro8&cx=015864032944730029962:5ipe0q27hgy&q=test&alt=json&num=20

它不起作用!

https://www.googleapis.com/customsearch/v1?key=AIzaSyCgGuZie_Xo-hOECNXOTKp5Yk7deryqro8&cx=015864032944730029962:5ipe0q27hgy&q=test&alt=json&num=10

有用!

但阅读文档

https://developers.google.com/custom-search/docs/xml_results#numsp

它说:

可选的.num参数标识要返回的搜索结果的数量.

默认的num值为10,最大值为20.如果请求的结果超过20,则只返回20个结果.

注意:如果搜索结果总数小于请求的结果数,则将返回所有可用的搜索结果.

有人遇到过这个问题吗?

PS:我也尝试将配置我的新自定义搜索引擎的REST请求发送到:网站搜索:每年100美元起,广告在结果页面上是可选的.

但是没有任何改变无法在请求/页面中获得20个结果

google-custom-search

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