临Android的2:什么是getTextView()和registerMenu()?Android、getTextView、registerMenu

由网友(穷鲸.)分享简介:清单中的acclaimed临Android的2本书(来源$ C ​​$ C可以发现这里)引用两个该功能的定义我一直没能找到无论是在Android的SDK或所有在这本书本身清单:getTextView()registerMenu()这些是什么功能,在那里他们可以找到?解决方案 公共无效的onCreate(包saved...

清单中的acclaimed临Android的2本书(来源$ C ​​$ C可以发现这里)引用两个该功能的定义我一直没能找到无论是在Android的SDK或所有在这本书本身清单:

getTextView() registerMenu()

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

解决方案

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

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

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

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

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

android getActionBar 闪退

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:

getTextView() 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'.

阅读全文

相关推荐

最新文章