相关疑难解决方法(0)

在Android资源ID之前,美元符号的含义是什么?

在接受以下帖子(Android自定义数字键盘)的答案中,我发现了一个我不理解的语法:

$(R.id.t9_key_0).setOnClickListener(this);
Run Code Online (Sandbox Code Playgroud)

美元符号在前面意味着什么?它是否与Android资源ID特别相关,还是更普通的Java语法?搜索引擎结果未显示任何合适的结果.

java android

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

如何为Android自定义键盘设置不同的键背景

我正在研究自定义键盘应用程序

当用户选择蓝色时,这是键的背景颜色

如果用户选择绿色,则应为背景色

这是input.xml软键盘背景颜色的代码: -

     @Override
    public View onCreateInputView() {


      Log.e("onStartInputView ","On StartInput View Called--");

      SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
      String Backgroundcolour = preferences.getString("BackgroundColour","");

     Log.e("Brithnesss- -","----"+Backgroundcolour);

    if(Backgroundcolour.equalsIgnoreCase("black"))
    {

    this.mInputView = (KeyboardView) getLayoutInflater().inflate(
            R.layout.input, null);


    }else
    {
        this.mInputView = (KeyboardView) getLayoutInflater().inflate(
            R.layout.input1, null);
        //this.mInputView.setB
    }

    this.mInputView.setOnKeyboardActionListener(this);
    this.mInputView.setKeyboard(this.mQwertyKeyboard);
    return this.mInputView;
}

 @Override public void onStartInputView(EditorInfo attribute, boolean restarting) {
    super.onStartInputView(attribute, restarting);
    // Apply the selected keyboard to the input view.

    setInputView(onCreateInputView());

}
Run Code Online (Sandbox Code Playgroud)

我没有得到如何设置特定键的背景图像.

android soft-keyboard android-softkeyboard

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

无法访问 AlertDialog 内的视图

我从这里复制了整个代码

Android自定义数字键盘

并在AlertDialog. 现在,当我调试应用程序时,onClick()不会调用该应用程序。

AlertDialog.Builder builder = new AlertDialog.Builder(context);
                builder.setView(R.layout.keypad_layout);
                builder.setCancelable(false).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                    }
                });
                builder.setPositiveButton("Modify", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {

                    }
                });
                builder.create().show();\
Run Code Online (Sandbox Code Playgroud)

警报对话框正在显示,正负按钮可以工作,唯一的问题是我无法访问布局内的视图

android android-alertdialog

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