谈到测试例子,那么往往都逃离不了经典的helloworld程序。
下面我们也不创新延续hello world的经典例子.
1、前面我们已经安装好了环境,接下来我们先创建存放我们日常用到workspace
找到你的安装目录然后在GNUstep目录底下创建workspace这个文件夹
2、在workspace文件夹里面建立hello文件夹
3、接下来我们要开始编写程序了,用记事本新建一个hello.m的文件,然后用记事本打开
(如果你有安装Notepad++那就不错,因为他有提供字体高亮的提示),把下面这段程序拷贝进去
#import<stdio.h> int main(int argc,const char *argv[]){ while(1){ printf("hello world\n"); } }
4、然后我们对这个hello.m进行编译:gcc -o hello hello.m
执行这句话后就在当前的文件夹里面出现hello.exe的可执行文件。双击后就会出现了我们想要的效果了!!
5、第一个程序就这样完成了!!
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
tabHost.getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.tabselector);
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, Tempo.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("Tab1").setIndicator("Tab1").setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, Abstand.class);
spec = tabHost.newTabSpec("Tab2").setIndicator("Tab2").setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, Katalog.class);
spec = tabHost.newTabSpec("Tab3").setIndicator("Tab3").setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, Misc.class);
spec = tabHost.newTabSpec("Tab4").setIndicator("Tab4").setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
然后在最后加上
tabs.getTabWidget().getChildAt(0).setBackgroundColor(R.drawable.my_selector);
<?xml version="1.0" encoding="UTF-8"?> <selector
android:id="@+id/tabSelector"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_focused="false"
android:state_selected="false"
android:state_pressed="true"
android:background="#32CD32"/> <br />
<item
android:state_focused="false"
android:state_selected="true"
android:state_pressed="false"/>
<item
android:state_focused="true"
android:state_selected="false"
android:state_pressed="false"/>
<item
android:state_focused="true"
android:state_selected="true"
android:state_pressed="false"/>
taht's helpful, thx
http://www.eoeandroid.com/thread-23630-1-1.html
http://www.iteye.com/topic/216436
http://www.eoeandroid.com/viewthread.php?tid=7881
http://www.devx.com/wireless/Article/40524
http://davanum.wordpress.com/2007/11/29/android-access-cell-phone-details-cell-id-lac-signal-strength/