临Android的2:什么是getTextView()和registerMenu()? [英] Pro Android 2: What are getTextView() and registerMenu()?

查看:162
本文介绍了临Android的2:什么是getTextView()和registerMenu()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

清单中的<一个3-33 href="http://stackoverflow.com/questions/4390290/fastest-path-to-anroid-development-for-a-non-java-programmer/4390314#4390314">acclaimed临Android的2本书(来源$ C ​​$ C可以发现这里)引用两个该功能的定义我一直没能找到无论是在Android的SDK或所有在这本书本身清单:

  1. getTextView()
  2. registerMenu()

这些是什么功能,在那里他们可以找到?

解决方案

 公共无效的onCreate(包savedInstanceState){
    super.onCreate(savedInstanceState);

        TextView的电视=新的TextView(本);
        tv.setText(Helloe,Android的打个招呼。);
        的setContentView(电视);
        registerForContextMenu(电视);
}
 

将修复这些方法的问题不存在。

和无书我看过Android是没有它的错字,缺位等。

PS。菜单将是一个菜单,显示了当你preSS向下的TextView。

Listing 3-33 in the acclaimed Pro Android 2 book (source code can be found here) references two functions of which definitions I haven't been able to find in either the Android SDK or all listings in the book itself:

  1. getTextView()
  2. registerMenu()

What are these functions and where can they be found?

解决方案

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

        TextView tv = new TextView(this);
        tv.setText("Helloe, Android. Say Hello");
        setContentView(tv);
        registerForContextMenu(tv);
}

will fix the problem of those methods not existing.

And no book I have read on Android is without its typos, missing bits etc.

PS. the menu will be a menu that shows up when you press down on the 'TextView'.

这篇关于临Android的2:什么是getTextView()和registerMenu()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆