<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>The journey with little green men &#187; User Interface</title>
	<atom:link href="http://bakhtiyor.com/tag/ui/feed/" rel="self" type="application/rss+xml" />
	<link>http://bakhtiyor.com</link>
	<description>Blog about mobile software development and the universe</description>
	<lastBuildDate>Sat, 12 Dec 2009 08:47:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>“iPhonish” Tabs</title>
		<link>http://bakhtiyor.com/2009/10/iphonish-tabs/</link>
		<comments>http://bakhtiyor.com/2009/10/iphonish-tabs/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 14:49:14 +0000</pubDate>
		<dc:creator>bakhtiyor</dc:creator>
				<category><![CDATA[User Interface]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[tabs]]></category>
		<guid isPermaLink="false">http://bakhtiyor.com/?p=431</guid>
		<description><![CDATA[Let me introduce my custom tabs recipe: custom tabs layout with RadioGroup widget and hidden TabWidget view. Layout file can looks like this: &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;TabHost xmlns:android=&#34;http://schemas.android.com/apk/res/android&#34; android:id=&#34;@android:id/tabhost&#34; android:layout_width=&#34;fill_parent&#34; android:layout_height=&#34;fill_parent&#34;&#62; &#60;LinearLayout android:orientation=&#34;vertical&#34; android:layout_width=&#34;fill_parent&#34; android:layout_height=&#34;fill_parent&#34;&#62; &#60;FrameLayout android:id=&#34;@android:id/tabcontent&#34; android:layout_width=&#34;fill_parent&#34; android:layout_height=&#34;0dip&#34; android:layout_weight=&#34;1&#34; android:padding=&#34;20dip&#34; android:background=&#34;#fff&#34;/&#62; &#60;RadioGroup android:layout_width=&#34;fill_parent&#34; android:layout_height=&#34;wrap_content&#34; android:orientation=&#34;horizontal&#34; android:checkedButton=&#34;@+id/first&#34; android:id=&#34;@+id/states&#34;&#62; &#60;RadioButton android:id=&#34;@+id/first&#34; android:background=&#34;@drawable/button_radio&#34; android:width=&#34;80dip&#34; android:height=&#34;70dip&#34; /&#62; &#60;RadioButton [...]]]></description>
			<content:encoded><![CDATA[<p>Let me introduce my custom tabs recipe: custom tabs layout with RadioGroup widget and hidden TabWidget view. Layout file can looks like this:</p>
<pre class="brush: xml">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;TabHost xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
  android:id=&quot;@android:id/tabhost&quot; android:layout_width=&quot;fill_parent&quot;
  android:layout_height=&quot;fill_parent&quot;&gt;
  &lt;LinearLayout android:orientation=&quot;vertical&quot;
    android:layout_width=&quot;fill_parent&quot; android:layout_height=&quot;fill_parent&quot;&gt;
    &lt;FrameLayout android:id=&quot;@android:id/tabcontent&quot;
      android:layout_width=&quot;fill_parent&quot; android:layout_height=&quot;0dip&quot;
      android:layout_weight=&quot;1&quot; android:padding=&quot;20dip&quot; android:background=&quot;#fff&quot;/&gt;
    &lt;RadioGroup android:layout_width=&quot;fill_parent&quot;
      android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;horizontal&quot;
      android:checkedButton=&quot;@+id/first&quot; android:id=&quot;@+id/states&quot;&gt;
      &lt;RadioButton android:id=&quot;@+id/first&quot; android:background=&quot;@drawable/button_radio&quot;
        android:width=&quot;80dip&quot; android:height=&quot;70dip&quot; /&gt;
      &lt;RadioButton android:id=&quot;@+id/second&quot; android:background=&quot;@drawable/button_radio&quot;
        android:width=&quot;80dip&quot; android:height=&quot;70dip&quot; /&gt;
      &lt;RadioButton android:id=&quot;@+id/third&quot; android:background=&quot;@drawable/button_radio&quot;
        android:width=&quot;80dip&quot; android:height=&quot;70dip&quot; /&gt;
      &lt;RadioButton android:id=&quot;@+id/fourth&quot; android:background=&quot;@drawable/button_radio&quot;
        android:width=&quot;80dip&quot; android:height=&quot;70dip&quot; /&gt;
    &lt;/RadioGroup&gt;
    &lt;TabWidget android:id=&quot;@android:id/tabs&quot;
      android:layout_width=&quot;fill_parent&quot; android:layout_height=&quot;wrap_content&quot;
      android:layout_weight=&quot;0&quot; android:visibility=&quot;gone&quot; /&gt;
  &lt;/LinearLayout&gt;
&lt;/TabHost&gt;
</pre>
<p>There is no way to setup button drawable of RadioButton widget in layout XML file, so we should do it at Activity create event:</p>
<pre class="brush: java">
    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.ebay);
        rbSecond.setButtonDrawable(R.drawable.flickr);
        rbThird.setButtonDrawable(R.drawable.skype);
        rbFourth.setButtonDrawable(R.drawable.you_tube);
        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;
                }
            }
        });
    }
</pre>
<p>Final result:<br />
    <img src="http://bakhtiyor.com/wp-content/uploads/2009/10/tabs.png" alt="tabs" title="tabs" width="320" height="480" class="aligncenter size-full wp-image-435" /></p>
<p>And as usual there are <a href="http://bakhtiyor.com/wp-content/uploads/2009/10/tabs.zip">source code</a> and <a href="http://bakhtiyor.com/wp-content/uploads/2009/10/tabs.apk">executable file</a>.</p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://bakhtiyor.com/2009/10/iphonish-tabs/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
