我得到的错误是:"值中的颜色"colorRed"在基值文件夹中没有声明;当在与此限定符不匹配的配置中查询资源时,这可能导致崩溃..."
我已经尝试过清理项目并重建,并尝试使缓存和重启无效,但仍然没有错误.
我附上了colors.xml文件的截图
我正在使用Googles这个api: -
https://www.google.com/speech-api/v2/recognize?output=json&lang="+ language_code +"&key ="我的密钥"
用于语音识别,它的工作非常好.
问题在于数字,即,如果我说one two three four结果将是 1234
,如果我说one thousand two hundred thirty four结果仍然是1234.
另一个问题是使用其他语言,即elf德语中的单词eleven.如果你说elf结果是11,而不是精灵.
我知道我们无法控制api但是有任何参数或黑客可以添加到这个api以强制它只返回单词.
有时候响应的结果是正确的,但并非总是如此.
这些是样本回复
1)当我说"一二三四"时
{"result":[{"alternative":[{"transcript":"1234","confidence":0.47215959},{"transcript":"1 2 3 4","confidence":0.25},{"transcript":"one two three four","confidence":0.25},{"transcript":"1 2 34","confidence":0.33333334},{"transcript":"1 to 34","confidence":1}],"final":true}],"result_index":0}
Run Code Online (Sandbox Code Playgroud)
2)当我说"一千二百三十四"时
{"result":[{"alternative":[{"transcript":"1234","confidence":0.94247383},{"transcript":"1.254","confidence":1},{"transcript":"1284","confidence":1},{"transcript":"1244","confidence":1},{"transcript":"1230 4","confidence":1}],"final":true}],"result_index":0}
Run Code Online (Sandbox Code Playgroud)
我做了什么.
检查结果是否为数字,然后按空格分割每个数字并检查结果数组中是否有相同的序列.在此结果中,结果1234变为1 2 3 4并将搜索结果数组中是否存在类似的序列,然后将其转换为单词.在第二种情况下,没有1 2 3 4,因此将坚持原始结果.
这是代码.
String numberPattern = "[0-9]";
Pattern r1 = Pattern.compile(numberPattern);
Matcher m2 = r1.matcher(output);
if (m2.find()) {
char[] digits2 = output.toCharArray();
String …Run Code Online (Sandbox Code Playgroud) 我使用Google语音Api v1开发了一款应用
https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang="+ language_code;
并且此链接用于获取响应.它工作正常,但从今天起它不起作用.我没有收到该链接的任何回复.任何人都有任何想法?有没有替代链接?请帮忙
protected String doInBackground(Void... params) {
// TODO Auto-generated method stub
String urlString = "https://www.google.com/speech-api/v2/recognize?xjerr=1&client=chromium&lang="
+ language_code;
// String urlString = "https://www.google.com/speech-api/v2/recognize? output=json&lang="+language_code+"s&key=AIzaSyCnl6MRydhw_5fLXIdASxkLJzcJh5iX0M4";
// Log.e("SpeechRecognizer url : ", urlString);
// String urlString =
// "https://www.google.com/speech-api/v1/recognize?xjerr=1&client=speech2text&lang="
// + language_code;
URL url;
try {
Log.e("", "started speech to text");
FLAC_FileEncoder fileEncoder = new FLAC_FileEncoder();
File inputfile = new File(Environment.getExternalStorageDirectory()
.getPath() + "/SpeechLibrary/speech.wav");
File outputfile = new File(Environment
.getExternalStorageDirectory().getPath()
+ "/SpeechLibrary/speech.flac");
fileEncoder.encode(inputfile, outputfile);
url = new URL(urlString);
HttpURLConnection con …Run Code Online (Sandbox Code Playgroud) android speech-recognition google-api speech-to-text android-speech-api
我开发了一个手写应用程序.其中一个主要特点是我们可以将字体从默认字体更改为4种其他自定义字体,即
Vicmorg (Vic Modern Cursive)
Cursive Writing 7
Dnealiancursive
Print-Regular
Run Code Online (Sandbox Code Playgroud)
这在所有设备上工作正常.昨天我将我的nexus 10更新为棒棒糖.现在没有正确使用字体,vicmorg.ttf和Dnealiancursive.ttf现在无法正常工作但是Print-Regular和Cursive Writing 7正在工作.没有问题但在其他手机中.有没有解决这个问题?请帮忙.
刚注意到英语美国单词不再显示正确的拼写.这之前还可以 - 现在显示英国英语拼写.下面是我找到的一些单词的列表.例如,如果我说中心 并将语言代码设置为en-US,我将得到结果作为英国英语的中心.
我使用的是Google api v2
https://www.google.com/speech-api/v2/recognize?output=json&lang=en-US&key=my_key "
词语结束-RE
以英语结尾的英国英语单词通常以美式英语结尾:
英国 和 美国
centre center
fibre fiber
litre liter
theatre theater or theatre
Run Code Online (Sandbox Code Playgroud)
尽管我将语言代码作为en-US,但返回的结果将是英式英语.这是一个常见问题或美国英语代码不再有效.任何帮助将不胜感激.
编辑
我只是注意到这个问题与ok谷歌一样即使我的输入是英文我们,我得到的答案是英文英文.这些是其他一些词
以-our结尾的单词
以-our结尾的英式英语单词通常以-or in American English结尾:
英国 和 美国
colour color
flavour flavor
humour humor
labour labor
neighbour neighbor
Run Code Online (Sandbox Code Playgroud)
英式英语中的动词可以拼写为-ize或-ise,最后拼写为-ize最后用美式英语拼写:
英国 和 美国
apologize or apologise apologize
organize or organise organize
recognize or recognise recognize
Run Code Online (Sandbox Code Playgroud)
以-yse结尾的单词
在英式英语中以动词结尾的动词总是拼写为美式英语:
英国 和 美国
analyse analyze
breathalyse breathalyze
paralyse paralyze
Run Code Online (Sandbox Code Playgroud) android speech-recognition google-api speech-to-text google-speech-api
使用此软件包com.google.android.gms.ads.AdSize; 我可以像这样设置我的广告
adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
Run Code Online (Sandbox Code Playgroud)
但是这个gms.ads是旧的.有没有其他方法可以在新包中实现相同的功能,即com.google.ads.AdSize; 提前致谢
新行上每个单词的第一个字母被切断为我们的denealian草书字体.
看看这个用填充的图片.如果我没有使用任何填充,它就像在图2中 
这是我的代码
<com.font.anything.writinghelper
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#000000"
android:padding="20dip"
android:textSize="60sp"
android:text="japanese google donkey elephant ostrich"
/>
Run Code Online (Sandbox Code Playgroud)
在这里编写帮助器是一个扩展textview的类,只是为了强调文本
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
Rect r = mRect;
int padding =55;
Paint paint = mPaint;
int count = getLineCount();
for (int i = 0; i < count; i++) {
int baseline = getLineBounds(i, r);
canvas.drawLine(r.left - padding, baseline, r.right + padding,
baseline, paint);
}
super.onDraw(canvas);
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮忙吗?
编辑
请求截图

有没有办法在TextView的左侧放置一些额外的空间?