Friday 15 March 2013

android - Set Invisible a layout , which is over layed on a tabs content view -


I have an activity that has a tabbed view and some buttons to display some layouts on the click view. The contents share the same content area to display when the content and content of the tabs are clicked. My tabs view content works perfectly well. When I click on the button and a layout increases on tab content, the layout looks fine. Now again clicking on tab view I want to make that layout invisible.

  import android.app.TabActivity; Import android.content.Context; Import android.content.Intent; Importroid.os.Bundle; Import android.util.log; Import android.view.LayoutInflater; Import android.view.View; Import android.view.View.OnClickListener; Import android.widget.ImageView; Import android.widget.LinearLayout; Import android.widget.LinearLayout.LayoutParams; Import android.widget.TabHost; Android Import Tabs. Tabspeak; Import android.widget.TabWidget; Import android.widget.TextView; Public Class Home Tabaktiviti (Tabhost mTabHost; Image View Contact Bitian; Rakikarekha Popapleaut; Override public void on @Create Instansstet saved (bundle) {Suprknkret (saved Instensstet); SetContentView (Rklayoutksaintgobain_home); (( TabWidget) findViewById (android.R.id.tabs) setOnClickListener (onclickListener) popupLayout = (LinearLayout) findViewById (R.id.popups); contactBtn = (imageView) findViewById (R.id.mailBtn); contactBtn.setOnClickListener ( onclickListener); MTabHost = (TabHost) findViewById (android.R.id.tabhost); intent BuildingIntent = new intent (). SetClass (this, HomeScreen.class); SetupTab (new Patdrish If (it), getResources (). GetString (R.string.buildingType_str), Bildingaintent); effect AppIntent = new Intent (). SetClass (This, ApplicationListkclass), Setup (new Tekstwu (it), gate Rijhorms () . GetString (R.string.Application_str), AppIntent); effect Utpadkanpani = new intent (). SetClass (this, ProductScreen.class); Setup (new Tekstwu (it), gate Rijhorms (). GetString (R.string.Product_str), Product Imantant); IntentDealer = new intent (intent) SetClass (this, dealer activity category); Setupabab (new textview (this), getResources (). GetString (R.string.Dealer_str), Intent Dealer); } Private Zero Setup tab (last scene view, last string tag, intent integrated Android) {View Tabview = CreateTab View (mTabHost.getContext (), tag); TabSpec setContent = mTabHost.newTabSpec (tag) .setIndicator (tabview) .setContent (intentAndroid); MTabHost.addTab (setContent); } Create a private static view tabview (last reference reference, last string lesson) {View View = LayoutInflator.fr (reference). Inflett (R.LT.TAT_text, empty); TextView TV = (TextView) view.findViewById (R.id.tabsText); Tv.setText (text); Return view; } OnClickListener onclickListener = new OnClickListener () {@Override on public void (see V) {switch (VkgetId ()) {case R.id.mailBtn: Log.d ( "", "mailbtn"); //((FrameLayout)findViewById (android.R.id.tabcontent)).setVisibility(View.INVISIBLE); LinearLayout.LayoutParams Parameters = new layoutprim (layout parama.philpaint, layout parama.phil_paint); View View = getLayoutInflater (). Flow (R. layout. Contact, zero); PopupLayout.addView (view, parameter); PopupLayout.setVisibility (View.VISIBLE); break; Case android R.Id.Tabs: if (popup layout. Gate visibility (see ==.visual); {PopupLayout.setVisibility (see. INVISIBLE); } break; }}}; }   

I'm not sure how to make the pop up layout invisible when I click on the tab widget again. Please help .. Thanks in advance :) < / Div>

Most probably do not listen to tabwidgett clicks ... you need to click the tab ... like this: < / p>

  (int i = 0; i & lt; tabs.getTabWidget (). GetChildCount (); i ++) {tabs.getTabWidget () getChildAt (i) .setOnClickListener (clickListener) ; }    

No comments:

Post a Comment