Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it possible to check if a specific "TAB" in TabWidget is visible in current View or not?
    primarykey
    data
    text
    <p>I have a <code>TabWidget</code> with 5 tabs in it. <strong>Tabs</strong> : "One","Two","Three","Four","Five". The <code>TabHost</code> is in a <code>HorizontalScrollView</code>. Now I've one arrow (&lt; and >) each on each side of the <code>TabWidget</code> to indicate that there are more tabs in that direction(which are currently not visible in view). </p> <p>Now what I want to do is, if the first tab is not visible(<strong>in current view</strong>) then the arrow to left (&lt;) should be visible and if the last tab is not visible(<strong>in current view</strong>) then the arrow to right should be visible and if both tabs are not visible(<strong>in current view</strong>) then both arrows should be visible. I tried doing it with:</p> <pre><code>if (horizontablscrollview.getLeft == 0) { arrowRight.setVisiblity(View.VISIBLE) arrowLeft.setVisiblity(View.INVISIBLE) } else if( horizontablscrollview.getRight == 0) { arrowLeft.setVisiblity(View.VISIBLE) arrowRight.setVisiblity(View.INVISIBLE) } else if ( horizontablscrollview.getRight == 0 &amp;&amp; horizontablscrollview.getLeft == 0) { arrowRight.setVisiblity(View.VISIBLE) arrowLeft.setVisiblity(View.VISIBLE) } </code></pre> <p>But this doesn't work, my both tabs are invisible in the start:</p> <p><strong>my xml looks like this..</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ffffff" &gt; &lt;RelativeLayout android:id="@+id/RL_Header" android:layout_width="fill_parent" android:layout_height="50dip" android:layout_marginBottom="3dip" android:background="@drawable/gradient" &gt; &lt;ImageButton android:id="@+id/btn_Home" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="3dp" android:background="@android:color/transparent" android:contentDescription="@string/description_home" android:onClick="onHomeButtonClick" android:src="@drawable/title_home" /&gt; &lt;ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginRight="5dip" android:layout_marginTop="5dip" android:background="@android:color/transparent" android:contentDescription="@string/description_about" android:onClick="onClickAbout" android:src="@drawable/title_about" /&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/FL_Tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/RL_Header" &gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/FL_Tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/RL_Header" &gt; &lt;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" android:background="#ffffff" &gt; &lt;ImageView android:id="@+id/arrow_left" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/i_button" android:layout_alignParentLeft="true"/&gt; &lt;RelativeLayout android:id="@+id/rl_tabs" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;ImageView android:id="@+id/arrow_left" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/i_button" android:layout_alignParentLeft="true" android:visibility="invisible"/&gt; &lt;ImageView android:id="@+id/arrow_Right" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/i_button" android:layout_alignParentRight="true" android:visibility="invisible"/&gt; &lt;HorizontalScrollView android:id="@+id/my_scrollView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:scrollbars="none" android:layout_toRightOf="@+id/arrow_left" android:layout_toLeftOf="@+id/arrow_Right"&gt; &lt;TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:tabStripEnabled="true"/&gt; &lt;/HorizontalScrollView&gt; &lt;/RelativeLayout&gt; &lt;FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingTop="65dip" &gt; &lt;RelativeLayout android:id="@+id/myTabContent" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="50dip" &gt; &lt;TableLayout android:id="@+id/tabSubs" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#ffffff" android:shrinkColumns="*" android:stretchColumns="*" &gt; &lt;TableRow android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="20dip" android:layout_marginTop="20dip" android:gravity="center_horizontal" &gt; &lt;Button android:id="@+id/btntestno1" android:layout_weight="1" android:gravity="center" android:padding="20dip" android:text="Test 1" android:textColor="#000000" /&gt; &lt;Button android:id="@+id/btntestno2" android:layout_weight="1" android:gravity="center" android:padding="20dip" android:text="Test 2" android:textColor="#000000" /&gt; &lt;/TableRow&gt; &lt;TableRow android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="20dip" android:gravity="center_horizontal" &gt; &lt;Button android:id="@+id/btntestno3" android:layout_weight="1" android:gravity="center" android:padding="20dip" android:text="Test 3" android:textColor="#000000" /&gt; &lt;Button android:id="@+id/btntestno4" android:layout_weight="1" android:gravity="center" android:padding="20dip" android:text="Test 4" android:textColor="#000000" /&gt; &lt;/TableRow&gt; &lt;TableRow android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="20dip" android:gravity="center_horizontal" &gt; &lt;Button android:id="@+id/btntestno5" android:layout_weight="1" android:gravity="center" android:padding="20dip" android:text="Test 5" android:textColor="#000000" /&gt; &lt;Button android:id="@+id/btntestno6" android:layout_weight="1" android:gravity="center" android:padding="20dip" android:text="Test 6" android:textColor="#000000" /&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; &lt;/RelativeLayout&gt; &lt;/FrameLayout&gt; &lt;/TabHost&gt; &lt;/RelativeLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Any help would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload