1. Check out our companion app, Forums for Android! Download from Google Play

Anybody can explain,,,wat is wrong in the code,,its not working

Discussion in 'Android Lounge' started by kiranuday43, Mar 5, 2010.

  1. kiranuday43

    kiranuday43 Member
    Thread Starter
    15

    Mar 3, 2010
    20
    0
    15
    in creating tablayout

    I created all the tabs ic_tab-albums etc,,..but still not working and want to place a button in albumsactivity:thinking:

    Tab Layout | Android Developers


    package com.android.Tablayout;

    import android.app.Activity;
    import android.os.Bundle;
    import android.view.Gravity;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;

    public class AlbumsActivity extends Activity{
    //private Button tv;

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    //showSplashScreen();
    showStartButton();
    }
    private void showStartButton()
    {
    //Button mybit=new Button(this);
    final Button mybit = (Button) findViewById(R.id.my_bit);

    // mybit.setText("albums lists");
    //tv.setMaxHeight(10);
    //tv.setHeight(2);
    //tv.setWidth(5);
    // mybit.setTextSize(40);
    //tv.setBackgroundColor(BIND_AUTO_CREATE);
    mybit.setGravity(Gravity.RIGHT);



    mybit.setOnClickListener(new OnClickListener() {
    //@Override
    public void onClick(View v) {
    boolean tv=true;
    tv=false;
    //finish();
    }
    });
    setContentView(R.id.my_bit);
    }


    }



    in 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:eek:rientation="vertical"
    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" />
    <Button android:id="@+id/my_bit"
    android:layout_width="125px" android:layout_height="50px"
    android:background="#FF222222" />

    </LinearLayout>
    </TabHost>
     

    Advertisement

Share This Page

Loading...