Android中实现可滑动的Tab的3种方式

2019-12-10 20:11:09王旭

            v.setBackgroundColor(r.nextInt() >> 8 | 0xFF << 24);

            TextView txvAddress = (TextView) v.findViewById(R.id.textView1);
            txvAddress.setTextColor(r.nextInt() >> 8 | 0xFF << 24);
            txvAddress.setBackgroundColor(r.nextInt() >> 8 | 0xFF << 24);

            txvAddress.setText(b.getString("address", ""));
            return v;
        }

    }
}

 

布局:

复制代码
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://www.easck.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

 

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="right|center_vertical" />

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >