小编Chr*_*ian的帖子

为ListAdapter项打开软键,其中包含带字符串的视图

我有一个ListAdapter,在这种情况下包含一个项目.该项生成一个具有EditText的视图.

当视图显示时,我想打开软键盘以允许用户编辑该字段.

我试着调用适配器的getView()函数:

View edittext = view.findViewById(R.id.EditText01);
edittext.requestFocus();
mInputMgr.showSoftInput(edittext, InputMethodManager.SHOW_FORCED);
Run Code Online (Sandbox Code Playgroud)

这似乎没有做任何事情.

我也尝试过:

View edittext = view.findViewById(R.id.EditText01);
edittext.requestFocus();
mInputMgr.toggleSoftInput(0, 0);
Run Code Online (Sandbox Code Playgroud)

这产生了一个神秘的原因,一个循环,其中软键盘可重复打开和关闭.

当我删除requestFocus并触摸点击程序中的EditText时,它会弹出软键盘,但是看看requestFocus是否存在,showSoftInput似乎不起作用.

我需要做什么?

list元素的XML:

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

  android:focusable="true"
  android:background="@color/light_blue"
  >

<EditText android:id="@+id/EditText01" 
android:layout_height="wrap_content" 
android:text="" 
android:focusable="true"
android:layout_width="fill_parent" android:inputType="textShortMessage"></EditText>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

包含ListView的XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:orientation="vertical"
  android:layout_height="fill_parent"
  >
    <Button android:text="@+id/Button01" 
        android:id="@+id/Button01" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"/>
    <ListView android:id="@+id/ListView01" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_below="@+id/Button01"
        android:gravity="center_horizontal"
        />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

long getView函数:

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    if …
Run Code Online (Sandbox Code Playgroud)

android android-softkeyboard

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

在另一个大列表中搜索一个大的单词列表

我有一个包含 1,000,000 个字符串的排序列表,最大长度为 256,带有蛋白质名称。每个字符串都有一个关联的 ID。我还有另一个未排序的 4,000,000,000 个字符串列表,最大长度为 256 个,单词不在文章中,每个单词都有一个 ID。

我想找到蛋白质名称列表和文章单词列表之间的所有匹配项。我应该使用哪种算法?我应该使用一些预构建 API 吗?

如果算法可以在没有特殊硬件的普通 PC 上运行,那就太好了。

估计算法所需的时间会很好,但不是强制性的。

search

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

最常见的词

Java中最有效的方法是使用频率从文本中获取50个最常用的单词?

我想搜索大约1,000,000个文本,每个文本大约有10,000个单词,并希望它在合理的时间范围内工作.

java

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

具有换行符或<br>的Android日志字符串

看来,如果你打电话

String text = "String<br>String";
Log.d(TAG, text);
Run Code Online (Sandbox Code Playgroud)

它会自动解析String以获取两行.新的line(\n)字符也是如此.这使调试变得更加复杂.有没有办法告诉记录器给我确切的字符串?

android android-logcat

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

在音乐中创建音符图像21

运行时出错:

from music21 import *

n1 = note.Note('C4', quarterLength=1)
n2 = note.Note('A4', quarterLength=1)
s = stream.Stream()
s.append(n1)
s.append(n2)
s.show('lily.svg')

Traceback (most recent call last):
  File "C:\Python34\test.py", line 7, in <module>
    s.show('lily.svg')
  File "C:\Python34\lib\site-packages\music21\base.py", line 2206, in show
    return formatWriter.show(self, regularizedConverterFormat, app=app, subformats=subformats, **keywords)
  File "C:\Python34\lib\site-packages\music21\converter\subConverters.py", line 277, in show
    returnedFilePath = self.write(obj, fmt, subformats=subformats, **keywords)
  File "C:\Python34\lib\site-packages\music21\converter\subConverters.py", line 245, in write
    conv = lily.translate.LilypondConverter()
  File "C:\Python34\lib\site-packages\music21\lily\translate.py", line 147, in __init__
    self.setupTools()
  File "C:\Python34\lib\site-packages\music21\lily\translate.py", line 177, in setupTools
    versionString = versionString.split()[-1] …
Run Code Online (Sandbox Code Playgroud)

python music21

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

如何将sox的语音mp3文件的速度降低到75%?

我如何调用sox将2秒音频文件转换为加速,以使文件的结果长度为1.5秒(75%)?我是否必须通过论证来进行音高修正?我必须通过哪些论据才能保持文件大小?

sox

5
推荐指数
2
解决办法
3136
查看次数

为CFFI安装Microsoft Visual C++ 14.0的方法是什么,它占用最少的硬盘空间?

我想编写使用的Python软件CFFI.CFFI本身抛出错误:

distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
Run Code Online (Sandbox Code Playgroud)

该页面上有多个下载.我不想从Microsoft Visual C++ Build Tools安装数GB的数据.我安装CFFI工作的最低要求是多少?

c++ python python-cffi microsoft-visual-c++

5
推荐指数
0
解决办法
575
查看次数

如何为我的自定义对象创建拾轮器?

我想让用户ArrayList<MyObjectType>通过外观类似于用于在数据选择器中选择日/月/年的车轮选择器的车轮选择器来选择元素。尽管日期选择器显然具有三个变量,但我只关心一个变量。

                                                  月选择器

实现这种选择器的最直接方法是什么?

user-interface android android-layout android-recyclerview

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

防止 Flutter 中通过 video_player 使用的 ExoPlayer 发送垃圾邮件日志

每当我在video_player中播放新文件时,我都会收到一长串日志,这使得查看我自己的日志记录变得更加困难。其中很多都包含记录值信息和嗨有没有办法让 video_player 不那么喋喋不休?

I/ExoPlayerImpl(21717): Init d44ef38 [ExoPlayerLib/2.9.6] [crosshatch, Pixel 3 XL, Google, 29]
W/MetadataUtil(21717): Failed to parse index/count attribute: trkn
D/CCodec  (21717): allocate(c2.qti.avc.decoder)
I/Codec2Client(21717): Creating a Codec2 client to service "default"
I/Codec2Client(21717): Client to Codec2 service "default" created
I/CCodec  (21717): setting up 'default' as default (vendor) store
I/CCodec  (21717): Created component [c2.qti.avc.decoder]
D/CCodecConfig(21717): read media type: video/avc
D/ReflectedParamUpdater(21717): extent() != 1 for single value type: output.buffers.pool-ids.values
D/CCodecConfig(21717): ignoring local param raw.size (0xd2001800) as it is already supported
D/CCodecConfig(21717): ignoring …
Run Code Online (Sandbox Code Playgroud)

exoplayer flutter flutter-video-player

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

哪些浏览器不支持空标签?

的IntelliJ棉短绒抛出Empty Tag-警告:

报告在某些浏览器中不起作用的空标记(例如script)。验证适用于html或jsp文件类型。

哪些浏览器受此问题影响?清除该警告有多重要?

html intellij-idea

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