Android演示能否处理触摸事件?

Android演示能否处理触摸事件?,android,Android,我知道Android可以有自己的布局,这意味着我可以创建按钮等UI组件。但是,有人知道演示文稿是否可以处理触摸事件吗 我曾尝试在演示布局上添加一个按钮,并在ClickListener上注册一个按钮,但似乎不起作用。还有别的办法吗 这是我的密码: 在我的演讲课上 mHelloToast = (Button) findViewById(R.id.btn_presentation_hello_toast); mHelloToast.setOnClickListener(new View.OnC

我知道Android可以有自己的布局,这意味着我可以创建按钮等UI组件。但是,有人知道演示文稿是否可以处理触摸事件吗

我曾尝试在演示布局上添加一个按钮,并在ClickListener上注册一个按钮,但似乎不起作用。还有别的办法吗

这是我的密码:

在我的演讲课上

mHelloToast = (Button) findViewById(R.id.btn_presentation_hello_toast);
    mHelloToast.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast toast = Toast.makeText(getContext(), "hello presentation", Toast.LENGTH_SHORT );
            toast.show();
        }
    });
编辑:凹凸显示:

演示文稿是一种特殊的对话框,其目的是在辅助显示器上演示内容。演示文稿在创建时与目标显示器关联,并根据显示器的指标配置其上下文和资源配置

所以我认为
Android Presention
可以像
Dialog
那样处理触摸事件。这里我将向您展示
Dialog
如何处理触摸事件

第一步 创建自定义布局
res/layout/dialog\u-sign.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <Button
        android:id="@+id/btn_presentation_hello_toast"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
</LinearLayout>

你说的演讲是什么意思?我从来没有听说过这个词在任何地方被使用过。只要看看你的代码就可以了,所以我们需要更多的信息来帮助你。一般来说:当然,任何UI组件都可以处理触摸事件,用户还应该如何与任何东西进行交互?@XaverKapeller我在编辑中添加了一个指向演示文稿api的链接,但演示文稿基本上是在外部显示器上显示布局。哦,好吧,我对此不太了解,然而,这似乎是可能的,因为您链接到的页面上的示例显示了一个对话框,这显然是一个需要直接用户交互的UI元素。谢谢您的回答,但我不认为这是我要找的。我的目标是能够将UI放在演示文稿上并在外部设备上显示,然后通过与外部显示器进行触摸交互来与外部显示器交互。
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Get the layout inflater
LayoutInflater inflater = getActivity().getLayoutInflater();
// Get the view which you want to receive touch event
//// Pass null as the parent view because its going in the dialog layout
View rootView = inflater.inflate(R.layout.dialog_signin, null);
Button bt = (Button)rootView.findViewById(R.id.btn_presentation_hello_toast);
// set click or touch listener
bt.setOnClickListener(....);

// set dialog's contents
builder.setView(rootView);