开发者

Android simple app with TabActivity

开发者 https://www.devze.com 2023-01-25 06:22 出处:网络
I am new to Android and I have been trying to reuse the tutorial on the Android developer website about developing a TabActivity App but, unfortunately, it never worked, even when I constructed it the

I am new to Android and I have been trying to reuse the tutorial on the Android developer website about developing a TabActivity App but, unfortunately, it never worked, even when I constructed it the exact same way as it is described… Using the debugger it seemed the problem came from the main layout.

-> setContentView(R.layout.main); //After this line the app stops.

Here is my main.xml:

<?xml version="1.0" encoding="utf-8"?>
<TabHost 
 xmlns:android="http://schemas.android.com/apk/res/android"    
 android:id="@android:id/tabhost"   
 android:layout_width="fill_parent"    
 android:layout_height="fill_parent">    
 <LinearLayout        
  android:orientation="vertical" 开发者_C百科       
  android:layout_width="fill_parent"        
  android:layout_height="fill_parent"        
  android:padding="5dp">        
  <TabWidget            
   android:id="@android:id/tabs"            
   android:layout_width="fill_parent"            
   android:layout_height="wrap_content" />        
  <FrameLayout            
   android:id="@android:id/tabcontent"            
   android:layout_width="fill_parent"            
   android:layout_height="fill_parent"            
   android:padding="5dp" />    
 </LinearLayout>
</TabHost>

If anyone had the same problem, or if someone have some advices they are welcome :)

Tanks a lot!

Randy


The xml you posted is the same as the TabHost example and there is nothing wrong with it. There must be something in your code.

Please post the code otherwise we can not help you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号