技术蛀虫

导航

2012年7月16日

android TabHost

摘要: 一个简单的TabHost布局1.首先继承TabActivity2.通过TabActivity的getTabHost()方法得到一个TabHost对象3.定义选项卡的内容(是一个FrameLayout的对象),并与TabHost绑定起来可以通过一下语句绑定TabHost容器的内容LayoutInflater.from(this).inflate(R.layout.main, tabHost.getTabContentView(), true);4.添加选项卡及设置选项的标题及内容我们知道添加选项卡需要指定一个TabSpec对象,通过TabHost的newTabSpec(选项卡的标识)可以得到,并 阅读全文

posted @ 2012-07-16 22:41 技术蛀虫 阅读(321) 评论(0) 推荐(0) 编辑

Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'问题的解决办法

摘要: 问题1. 运行Activity的时候出现Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'添加Layout的时候,xml跟元素选择TabHost, 但是ADT没有添加id属性, 运行的时候,会提示Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'错误, 需要添加android:id="@android:id/tabhost", 这样就可以 阅读全文

posted @ 2012-07-16 22:00 技术蛀虫 阅读(828) 评论(0) 推荐(0) 编辑

android Notification

摘要: 1 import android.app.PendingIntent; 2 import android.app.NotificationManager; 3 import android.app.Notification; 4 5 NotificationManager nm = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); 6 Notification n = new Notification(R.drawable.chat, "Hello,there!",... 阅读全文

posted @ 2012-07-16 19:57 技术蛀虫 阅读(310) 评论(0) 推荐(0) 编辑