我想申请我的应用程序自定义语音操作,以启动我的应用程序.它应该看起来像:'好吧,谷歌' - >'直接匹配'和我的应用程序运行.这该怎么做?
在应用程序上工作,用户必须在其中放入一些数据EditText,但在此前后EditText我才有TextViews.为此我用(horizontal) LinearLayout我放的地方TextView EditText TextView.我遇到了线路转移的问题.请帮我找一个解决方案.
它现在看起来像这样:
|blabla_______tatata|
| tatata|
Run Code Online (Sandbox Code Playgroud)
我需要这样的:
|blabla_______tatata|
|tatata |
Run Code Online (Sandbox Code Playgroud)
我试图使用FlowTextView但它没有帮助,它看起来很丑,只能用于图片.
问题是:如果没有足够的空间,它会移动到第二行.请帮我在这里做一些修正:
表现
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nikolai.app">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
主要活动
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Run Code Online (Sandbox Code Playgroud)
HorizontalFlowLayout
public class HorizontalFlowLayout extends RelativeLayout {
/**
* …Run Code Online (Sandbox Code Playgroud) 我有一个ViewPager,我需要在那里使用一个按钮.按钮必须识别语音,并在TextView中显示.我为VoiceRecognition和ViewPager实现了相同的布局.
问题是:如何激活按钮以在单击后运行VoiceRecognition.我尝试在Button和TextView上设置标签,但是我做错了,它不起作用.
ViewPager:
public class SwipeAdapter extends PagerAdapter{
private int[] car = {R.string.car1, R.string.car2,
R.string.car3, R.string.car4, R.string.car5};
private Context context;
private LayoutInflater layoutInflater;
public SwipeAdapter(Context context){
this.context = context;
}
@Override
public int getCount() {
return car.length;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return (view==(RelativeLayout)object);
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View itemView = layoutInflater.inflate(R.layout.carSwipe, container, false);
//Implement the Button
Button carBut = (Button)itemView.findViewById(R.id.buttonCar);
carButton.setTag("car");
TextView textView = (TextView) itemView.findViewById(R.id.interTextView); …Run Code Online (Sandbox Code Playgroud) 要在我的应用中播放视频,我决定从YouTube Android Player API扩展.但问题是我的菜单消失了,因为我没有从AppCompatActivity扩展.问题是:如何使用YouTube Android Player API并在应用中添加菜单?
public class TutorialsActivity extends YouTubeBaseActivity {
private YouTubePlayerView youTubePlayerView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.youtube);
youTubePlayerView = (YouTubePlayerView) findViewById(R.id.video1);
youTubePlayerView.initialize(API_KEY, new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
youTubePlayer.loadVideo("c9q88492aas");
youTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.MINIMAL);
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
}
});
}
Run Code Online (Sandbox Code Playgroud)
XML
<com.google.android.youtube.player.YouTubePlayerView
android:id="@+id/video1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
Run Code Online (Sandbox Code Playgroud)
当我从AppCompatActivity扩展时,它只是给我一个错误.
错误日志:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hyber.app/com.hyber.app.TutorialsActivity}: android.view.InflateException: Binary XML file line #12: Binary XML file line …Run Code Online (Sandbox Code Playgroud) 我正在做自动化测试,我需要在文本字段中输入文本,但问题是没有“输入”来执行此操作。
这个不行:
document.querySelector([class*=modal-dialog] [class*=AddCitation_] [class*='DraftEditorPlaceholder']).value='Hello World'
Run Code Online (Sandbox Code Playgroud)
有谁知道如何在draft.js中输入文本?
当我打开Web应用程序时,我会弹出一个窗口。我试图通过两种方式单击“允许”按钮:
1)当我添加权限时:
caps.setCapability("autoGrantPermissions", true);
caps.setCapability("autoAcceptAlerts", true);
......
driver.switchTo().alert().accept();
Run Code Online (Sandbox Code Playgroud)
没发生什么事((
2)当我尝试通过XPath查找它时:
driver.findElement(By.xpath("//android.widget.Button[@text='Allow']")).click();
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//android.widget.Button[@text='Allow']"}
Run Code Online (Sandbox Code Playgroud)
这是我从UI Automator Viewer截取的屏幕截图:
我发现了这篇文章:在Appium中点击许可警报的“允许”按钮后,无法点击链接? 但这对我没有帮助。
我使用Volley库制作了一个项目(BlogReader).如果我用UTF-8编码json文件并重新加载我的AndroidStudio仿真器,列表视图将变为白色(带有菜单标题的白色空白).如果我再次在ANSI或win-1251上更改json编码它开始工作.我更改了UTF-8上的Android文件编码设置,但没有任何改变.怎么解决这个问题?
PS.对不起,无法加载截图,声望很低(
我用英语制作了一个应用程序。我的应用程序使用语音识别。但是,如果我在使用其他系统语言(例如法语或俄语)的设备上安装此应用程序。我的语音识别不起作用。它仅适用于系统默认的语言。如何为我的应用程序默认使用英语进行语音识别?
我找到了这个方法,但它不起作用
Locale myLocale;
myLocale = new Locale("English (US)", "en_US");
Locale.setDefault(myLocale);
android.content.res.Configuration config = new android.content.res.Configuration();
config.locale = myLocale;
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
Run Code Online (Sandbox Code Playgroud) 我想使用递归运行某个函数一定次数,例如:repeat(console.log('Hello'), 3)应该打印 Hello 3 次。我试图实现这样的功能,但它只打印一个 word Hello。
function repeat(w, x){
let fun = function(arg){
return arg
}
if (x==1){
return fun(w)
}
else{
return fun(w)+repeat(fun(w), x-1)
}
}
repeat(console.log('Hello'), 3)Run Code Online (Sandbox Code Playgroud)
android ×6
java ×2
javascript ×2
appium ×1
automation ×1
draftjs ×1
encoding ×1
json ×1
reactjs ×1
selenium ×1
tailwind-css ×1
testing ×1