GridView与TableLayout | Android的

时间:2010-10-21 20:02:35

标签: android

您好 我想用可点击的日子为android创建月视图日历。我应该使用什么样的布局/视图,TableLayout或GridView。我没有找到任何这方面的例子......

提前感谢您的帮助

2 个答案:

答案 0 :(得分:2)

我会说GridView,特别是如果您计划将所有日历数据放在ContentProvider中以便与其他应用共享。然后,您可以使用提供程序和适配器动态填写GridView

答案 1 :(得分:2)

检查GridView上的fallowing教程:

http://www.firstdroid.com/2011/02/06/android-tutorial-gridview-with-icon-and-text/

在理解本教程后,只需在onCreate方法的末尾添加以下行:

grid_main.setOnItemClickListener(new OnItemClickListener() {
    public void onItemClick(AdapterView<?> parent, View view, int position, 
                            long id) {

        // Add your code here, you receive the index, 
        // you can start an intent or do whatever you wanted 
        // to do with the button

     }/* End of onItemClick */
});

BR,

阿德里安。