删除选项卡活动上的暗覆盖(android)

时间:2011-05-27 02:56:30

标签: android overlay tabactivity

我使用此方法制作了自定义标签:http://bakhtiyor.com/2009/10/iphonish-tabs/

似乎选择每个标签时会出现轻微的黑色叠加,请参见此屏幕截图:

tab image

我希望颜色与标签底部和屏幕的其余部分无缝连接。谁能告诉我如何摆脱叠加/黑暗?

谢谢:)

这是标签布局xml:

    <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">
  <RelativeLayout android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <FrameLayout android:id="@android:id/tabcontent"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_weight="1"
      android:padding="5dip"
      android:background="#ede7da"
      android:layout_marginTop="50dip"/>
    <RadioGroup android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:checkedButton="@+id/first"
      android:id="@+id/states">
      <RadioButton android:id="@+id/first"
      android:background="@drawable/button_radio"
      android:text="Settings"
      android:textColor="#dda88f"
      android:textSize="12dip"
      android:gravity="center"
        android:width="80dip"
        android:height="70dip" />
      <RadioButton android:id="@+id/second"
      android:background="@drawable/button_radio"
      android:text="Reminders"
      android:textColor="#dda88f"
      android:textSize="12dip"
      android:gravity="center"
        android:width="80dip"
        android:height="70dip" />
      <RadioButton android:id="@+id/third"
      android:background="@drawable/button_radio"
      android:text="Help"
      android:textColor="#dda88f"
      android:textSize="12dip"
      android:gravity="center"
        android:width="80dip"
        android:height="70dip" />
        <RadioButton android:id="@+id/fourth"
      android:background="@drawable/button_radio"
      android:text="Spare"
      android:textColor="#dda88f"
      android:textSize="12dip"
      android:gravity="center"
        android:width="80dip"
        android:height="70dip" />
    </RadioGroup>
    <com.bitty.kegelkat.PopupButton
                android:id="@+id/okbutton"
                android:background="@drawable/popup_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="16dp"
                android:textColor="#b6b6b6"
                android:textSize="30sp"
                android:text="OK"
                />
    <TabWidget android:id="@android:id/tabs"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_weight="0"
      android:visibility="gone" />
  </RelativeLayout>
</TabHost>

这是标签代码:

setupUI();

        Resources res = getResources(); // Resource object to get Drawables
        TabHost tabHost = getTabHost();  // The activity TabHost
        TabHost.TabSpec spec;  // Resusable TabSpec for each tab
        Intent intent;  // Reusable Intent for each tab

        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, Settings.class);

        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("settings").setIndicator("Settings",
                          res.getDrawable(R.drawable.tab_settings))
                      .setContent(intent);
        tabHost.addTab(spec);

        // Do the same for the other tabs
        intent = new Intent().setClass(this, Reminders.class);
        spec = tabHost.newTabSpec("reminders").setIndicator("Reminders",
                          res.getDrawable(R.drawable.tab_settings))
                      .setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, About.class);
        spec = tabHost.newTabSpec("about").setIndicator("Help/About",
                          res.getDrawable(R.drawable.tab_settings))
                      .setContent(intent);
        tabHost.addTab(spec);

        tabHost.setCurrentTab(0);

private void setupUI() {
        RadioButton rbFirst = (RadioButton) findViewById(R.id.first);
        RadioButton rbSecond = (RadioButton) findViewById(R.id.second);
        RadioButton rbThird = (RadioButton) findViewById(R.id.third);
        RadioButton rbFourth = (RadioButton) findViewById(R.id.fourth);
        rbFirst.setButtonDrawable(R.drawable.blank);
        rbSecond.setButtonDrawable(R.drawable.blank);
        rbThird.setButtonDrawable(R.drawable.blank);
        rbFourth.setButtonDrawable(R.drawable.blank);
        RadioGroup rg = (RadioGroup) findViewById(R.id.states);
        rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            public void onCheckedChanged(RadioGroup group, final int checkedId) {
                switch (checkedId) {
                case R.id.first:
                    getTabHost().setCurrentTab(0);
                    break;
                case R.id.second:
                    getTabHost().setCurrentTab(1);
                    break;
                case R.id.third:
                    getTabHost().setCurrentTab(2);
                    break;
                case R.id.fourth:
                    getTabHost().setCurrentTab(3);
                    break;
                }
            }
        });

0 个答案:

没有答案