android:onClick事件

android:onClick事件用户捕获用户的点击,在Activity里面实现点击的处理逻辑。

    <Button
        android:text="@string/hello_world"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:onClick="sendMessage"/>
    public void sendMessage(View view)
    {
        // Create the text view
        TextView textView = new TextView(this);
        textView.setTextSize(40);
        textView.setText("ok");

        // Set the text view as the activity layout
        setContentView(textView);

    }

 

posted on 2015-05-26 15:01  2015xbx  阅读(235)  评论(0编辑  收藏  举报

导航