凸起的标签android消失了

时间:2013-03-11 07:41:11

标签: java android

我从这里下载了用于android的凸起标签主机:

https://github.com/AdilSoomro/Raised-Center-Tab-in-Android

我写了这段代码:

public class TabMainActivity extends TabActivity {
    TabHost tabHost;
    private String name;
    private String city;
    private String country;
    private String street;
    private String id;
    private String email;
    private String password;
    private String phone;
    private String emailOwner;



    /** Called when the activity is first created. */


    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tab_main);

         Intent intent = getIntent();
            name = intent.getExtras().getString("name");
            password = intent.getExtras().getString("password");
            email = intent.getExtras().getString("email");
            id = intent.getExtras().getString("id");
            phone = intent.getExtras().getString("phone");

            emailOwner=intent.getExtras().getString("emailOwner");
        tabHost = getTabHost();
        setTabs();
    }
    private void setTabs()
    {
        addTab("Home", R.drawable.tab_home, ProfileActivity.class);
        addTab("Search", R.drawable.tab_search, SaleMapActivity.class);
        addTab("Fake", R.drawable.tab_search, GroupMapActivity.class);
        addTab("Home", R.drawable.tab_home, DeliverMapActivity.class);
        addTab("Search", R.drawable.tab_search, ProfileActivity.class);
    }
    private void addTab(String labelId, int drawableId, Class<?> c)
    {
        Intent intent = new Intent(this, c);

        intent.putExtra("emailOwner", emailOwner);
        intent.putExtra("phone", phone);
        intent.putExtra("email",email  );
        intent.putExtra("password",password  );
        intent.putExtra("id",id  );
        intent.putExtra("name",name  );
        TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId); 

        View tabIndicator = LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false);
        TextView title = (TextView) tabIndicator.findViewById(R.id.title);
        title.setText(labelId);
        ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
        icon.setImageResource(drawableId);      
        spec.setIndicator(tabIndicator);
        spec.setContent(intent);
        tabHost.addTab(spec);
    }
    public void openCameraActivity(View b)
    {
        Intent i = new Intent(this, ProfileActivity.class);

        i.putExtra("emailOwner", emailOwner);
        i.putExtra("phone", phone);
        i.putExtra("email",email  );
        i.putExtra("password",password  );
        i.putExtra("id",id  );
        i.putExtra("name",name  );
        startActivity(i);
    }
}

每当我点击中心按钮(cumera按钮)时,它会打开配置文件活动但是标签会消失..

如何点击居中的按钮(相机按钮)来实现标签不会显示?

感谢

0 个答案:

没有答案