【问题标题】:Button OnClickListener giving ViewPostImeInputStage ACTION_DOWN error按钮 OnClickListener 给出 ViewPostImeInputStage ACTION_DOWN 错误
【发布时间】:2019-05-22 11:00:17
【问题描述】:

我正在尝试创建一个简单的 Android 程序。我创建了一个活动并只添加了一个按钮,我在该按钮上设置了一个 OnclickListener 以在日志中打印“Hello World”,这是一项简单的任务。但是每当我运行应用程序时,每次单击按钮时,都会收到错误“ViewPostImeInputStage ACTION_DOWN”。

我尝试将我的布局放在 FragmentLayout 中,或者构建另一个项目,或者更新 Android Studio,所有这些都是这里推荐的解决方案。这些都不起作用,我仍然得到同样可怕的“ViewPostImeInputStage ACTION_DOWN”。

这是我的 java 文件

Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

button= findViewById(R.id.button);

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        System.out.print("Hello World");
    }
});
}

还有我的xml文件

   `<FrameLayout xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="243dp"
            android:text="Button" />
    </RelativeLayout></FrameLayout>

如果有人能帮我解决这个问题,将不胜感激。 OnclickListener 对我来说一直很顺利,但由于某种原因,现在我无法完成最基本的任务。救命!

【问题讨论】:

    标签: java android button onclicklistener


    【解决方案1】:

    Germain Edouard 尝试在

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-17
      • 2014-11-12
      相关资源
      最近更新 更多