User-agent: Mediapartners-Google Disallow: User-agent: * Disallow: /search Allow: / Sitemap: http://nox4developper.blogspot.com/sitemap.xml Nox 4 developper: [Q] How can custom tab view be implemented using setCustomTabView method topic

[Q] How can custom tab view be implemented using setCustomTabView method topic






I am using Android's SlidingTabColors sample in my application layout. I have three tabs initialized. Due to the default tab layout all the tabs have same layout. I have searched everything about setCustomTabView; but unable to get it implemented. I wanted to know where should i call this method? What statements are to be used? I have used a switch statement in the onViewCreated method of the ContentFragment class. The code I have written in the onViewCreated method is posted below:

[ public void onViewCreated(View view, Bundle savedInstanceState)
{
super.onViewCreated(view, savedInstanceState);
TextView title = (TextView) view.findViewById(R.id.item_title);
int indicatorColor = args.getInt(KEY_INDICATOR_COLOR);
switch (indicatorColor)
{
case Color.RED:
{
SlidingTabLayout mSlidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
mSlidingTabLayout.setCustomTabView(R.layout.speed_ test, R.id.hello1);
}
case Color.GREEN:
title.setText("Subject: " + args.getCharSequence(KEY_TITLE));
case Color.BLUE:
title.setText("Header: " + args.getCharSequence(KEY_TITLE));
}
} ]
The speed_test.xml file is posted below:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Hello"
android:id="@+id/hello1"
/>
</RelativeLayout>






Aucun commentaire:

Enregistrer un commentaire