Example usage for android.widget LinearLayout SHOW_DIVIDER_NONE

List of usage examples for android.widget LinearLayout SHOW_DIVIDER_NONE

Introduction

In this page you can find the example usage for android.widget LinearLayout SHOW_DIVIDER_NONE.

Prototype

int SHOW_DIVIDER_NONE

To view the source code for android.widget LinearLayout SHOW_DIVIDER_NONE.

Click Source Link

Document

Don't show any dividers.

Usage

From source file:in.mashroom.matome.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mActivity = this;
    setContentView(R.layout.activity_main);

    ParseAnalytics.trackAppOpenedInBackground(getIntent());

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager(), this);

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    tabHost = (TabHost) findViewById(android.R.id.tabhost);
    tabHost.setup();// w  w w .  j a  v a 2 s .co  m

    // ??
    tabWidget = (TabWidget) findViewById(android.R.id.tabs);
    tabWidget.setStripEnabled(false);
    tabWidget.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);

    LayoutInflater inflater = LayoutInflater.from(this);
    for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
        TextView tv = (TextView) inflater.inflate(R.layout.tab_widget, tabWidget, false);
        tv.setText(mSectionsPagerAdapter.getPageTitle(i));

        tabHost.addTab(
                tabHost.newTabSpec(String.valueOf(i)).setIndicator(tv).setContent(android.R.id.tabcontent));
    }

    indicator = findViewById(R.id.indicator);
    mViewPager.setOnPageChangeListener(new PageChangeListener());

    // ActionBar??
    getSupportActionBar().setElevation(0);
    getSupportActionBar().setDisplayShowTitleEnabled(true);

    // ??
    float elevation = 4 * getResources().getDisplayMetrics().density;
    tabHost.setElevation(elevation);

    tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            mViewPager.setCurrentItem(Integer.valueOf(tabId));
        }
    });

    // Ad
    AdView mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
}

From source file:org.openmidaas.app.activities.MainTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.activity_main_tab);

    //Get the text
    tabProfile = getResources().getString(R.string.profileTabtext);
    tabScan = getResources().getString(R.string.scanTabtext);
    tabInputURL = getResources().getString(R.string.urlTabtext);

    //Enabling action bar
    ActionBar actionBar = getActionBar();
    actionBar.setTitle(null);//from  www . ja  v  a2s  . c om
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.show();
    getOverflowMenu();

    mActivity = this;
    mProgressDialog = new ProgressDialog(mActivity);

    mAttributeListFragment = new AttributeListFragment();
    mUrlInputFragment = new EnterURLDialogFragment();
    mScanFragment = new ScanFragment();

    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabHost.setOnTabChangedListener(listener);
    mTabHost.setup();
    mTabHost.getTabWidget().setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    //initializing tabs
    initializeTab();
    //Check for updates
    checkForUpdates();
    //See if its being called to process URL from push message. 
    //MainAcivity not being killed to be consistent with what happens when the URL taken via QR code etc.
    if ((getIntent().getExtras() != null) && !getIntent().getExtras().isEmpty()) {
        if (getIntent().getAction().equals(Constants.IntentActionMessages.PROCESS_URL)) {
            processUrl(getIntent().getExtras().getString("url"));
        }
    }
}

From source file:net.yanzm.mth.MaterialTabHost.java

public MaterialTabHost(Context context, AttributeSet attrs) {
    super(context, attrs);

    inflater = LayoutInflater.from(context);

    TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.MaterialTabHost, 0, 0);
    int indicatorColor = a.getColor(R.styleable.MaterialTabHost_colorTabIndicator, Color.YELLOW);
    colorControlActivated = a.getColor(R.styleable.MaterialTabHost_colorBackground, Color.WHITE);

    setBackgroundColor(colorControlActivated);
    a.recycle();/*from ww w .  j  a  v a2  s  .  co m*/

    // ColorDrawable on 2.x does not use getBounds() so use ShapeDrawable
    indicator = new ShapeDrawable();
    indicator.setColorFilter(indicatorColor, PorterDuff.Mode.SRC_ATOP);

    Resources res = context.getResources();
    indicatorHeight = res.getDimensionPixelSize(R.dimen.mth_tab_indicator_height);
    leftOffset = res.getDimensionPixelSize(R.dimen.mth_tab_left_offset);
    int tabHeight = res.getDimensionPixelSize(R.dimen.mth_tab_height);

    tabWidget = new TabWidget(context);
    tabWidget.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, tabHeight));
    tabWidget.setId(android.R.id.tabs);
    tabWidget.setStripEnabled(false);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        tabWidget.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    }
    addView(tabWidget);

    FrameLayout fl = new FrameLayout(context);
    fl.setLayoutParams(new LayoutParams(0, 0));
    fl.setId(android.R.id.tabcontent);
    addView(fl);

    setup();

    setOnTabChangedListener(new TabHost.OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            if (listener != null) {
                listener.onTabSelected(Integer.valueOf(tabId));
            }
        }
    });

    float density = getResources().getDisplayMetrics().density;

    // set elevation for App bar
    // http://www.google.com/design/spec/what-is-material/objects-in-3d-space.html#objects-in-3d-space-elevation
    ViewCompat.setElevation(this, APP_TAB_ELEVATION * density);
}

From source file:com.achep.base.ui.DialogBuilder.java

private View createSkeleton() {
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout rootLayout = (LinearLayout) inflater.inflate(R.layout.dialog_main_skeleton,
            new FrameLayout(mContext), false);
    TextView titleView = (TextView) rootLayout.findViewById(R.id.title);

    if (Device.hasLollipopApi()) {
        // The dividers are quite ugly with material design.
        rootLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    }//ww w .j  av  a2  s .  c o  m

    if (mTitleText == null && mIcon == null) {
        rootLayout.removeView(titleView);
    } else {
        if (mTitleText != null)
            titleView.setText(mTitleText);
        if (mIcon != null)
            titleView.setCompoundDrawablesWithIntrinsicBounds(mIcon, null, null, null);
    }

    return rootLayout;
}

From source file:com.jecelyin.android.common.widget.TabLayout.java

public TabLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    // Disable the Scroll Bar
    setHorizontalScrollBarEnabled(false);
    // Set us to fill the View port
    setFillViewport(true);// www. jav a 2s  . c  o m

    // Add the TabStrip
    mTabStrip = new SlidingTabStrip(context);

    TypedArray a;
    //add divider support
    if (Build.VERSION.SDK_INT >= 11) {
        a = context.getTheme().obtainStyledAttributes(attrs, new int[] { android.R.attr.divider,
                android.R.attr.showDividers, android.R.attr.dividerPadding, }, defStyleAttr, 0);
        mDivider = a.getDrawable(0);
        mShowDividers = a.getInt(1, LinearLayout.SHOW_DIVIDER_NONE);
        mDividerPadding = a.getDimensionPixelSize(2, 0);
        a.recycle();
        //?????
        a = context.getTheme().obtainStyledAttributes(attrs, new int[] { android.R.attr.lineSpacingMultiplier },
                defStyleAttr, 0);
        mSpacingMult = a.getFloat(0, 1.0f);
        a.recycle();

        if (Build.VERSION.SDK_INT >= 14) {
            mTabStrip.setDividerPadding(mDividerPadding);
        } else {
            Rect b = mDivider.getBounds();
            mDivider.setBounds(b.left, b.top, b.right + mDividerPadding * 2, b.bottom);
        }
        mTabStrip.setDividerDrawable(mDivider);
        mTabStrip.setShowDividers(mShowDividers);
    }
    //end

    addView(mTabStrip, LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);

    a = context.obtainStyledAttributes(attrs, R.styleable.TabLayout, defStyleAttr,
            R.style.Widget_Design_TabLayout);

    mTabStrip.setSelectedIndicatorHeight(a.getDimensionPixelSize(R.styleable.TabLayout_tabIndicatorHeight, 0));
    mTabStrip.setSelectedIndicatorColor(a.getColor(R.styleable.TabLayout_tabIndicatorColor, 0));

    mTabTextAppearance = a.getResourceId(R.styleable.TabLayout_tabTextAppearance,
            R.style.TextAppearance_Design_Tab);

    mTabPaddingStart = mTabPaddingTop = mTabPaddingEnd = mTabPaddingBottom = a
            .getDimensionPixelSize(R.styleable.TabLayout_tabPadding, 0);
    mTabPaddingStart = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingStart, mTabPaddingStart);
    mTabPaddingTop = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingTop, mTabPaddingTop);
    mTabPaddingEnd = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingEnd, mTabPaddingEnd);
    mTabPaddingBottom = a.getDimensionPixelSize(R.styleable.TabLayout_tabPaddingBottom, mTabPaddingBottom);

    if (a.hasValue(R.styleable.TabLayout_tabSelectedTextColor)) {
        mTabSelectedTextColor = a.getColor(R.styleable.TabLayout_tabSelectedTextColor, 0);
        mTabSelectedTextColorSet = true;
    }

    mTabMinWidth = a.getDimensionPixelSize(R.styleable.TabLayout_tabMinWidth, 0);
    mRequestedTabMaxWidth = a.getDimensionPixelSize(R.styleable.TabLayout_tabMaxWidth, 0);
    mTabBackgroundResId = a.getResourceId(R.styleable.TabLayout_tabBackground, 0);
    mContentInsetStart = a.getDimensionPixelSize(R.styleable.TabLayout_tabContentStart, 0);
    mMode = a.getInt(R.styleable.TabLayout_tabMode, MODE_FIXED);
    mTabGravity = a.getInt(R.styleable.TabLayout_tabGravity, GRAVITY_FILL);
    a.recycle();

    // Now apply the tab mode and gravity
    applyModeAndGravity();
}

From source file:com.sentaroh.android.SMBExplorer.SMBExplorerMain.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void createTabAndView() {
    mThemeColorList = ThemeUtil.getThemeColorList(mActivity);

    tabHost = (TabHost) findViewById(android.R.id.tabhost);
    tabHost.setup();//from   w  w w.jav  a  2  s .  c  o m

    mTabWidget = (TabWidget) findViewById(android.R.id.tabs);

    if (Build.VERSION.SDK_INT >= 11) {
        mTabWidget.setStripEnabled(false);
        mTabWidget.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    }

    View childview2 = new CustomTabContentView(this, "Profile");
    TabHost.TabSpec tabSpec1 = tabHost.newTabSpec("@P").setIndicator(childview2)
            .setContent(R.id.explorer_profile_tab);
    tabHost.addTab(tabSpec1);

    View childview4 = new CustomTabContentView(this, SMBEXPLORER_TAB_LOCAL);
    TabHost.TabSpec tabSpec4 = tabHost.newTabSpec(SMBEXPLORER_TAB_LOCAL).setIndicator(childview4)
            .setContent(R.id.explorer_filelist_local_tab);
    tabHost.addTab(tabSpec4);

    View childview5 = new CustomTabContentView(this, SMBEXPLORER_TAB_REMOTE);
    TabHost.TabSpec tabSpec5 = tabHost.newTabSpec(SMBEXPLORER_TAB_REMOTE).setIndicator(childview5)
            .setContent(R.id.explorer_filelist_remote_tab);
    tabHost.addTab(tabSpec5);

    //      tabHost.setCurrentTab(0);
    tabHost.setOnTabChangedListener(new OnTabChange());

    localFileListDirSpinner = (Spinner) findViewById(R.id.explorer_filelist_local_tab_dir);
    remoteFileListDirSpinner = (Spinner) findViewById(R.id.explorer_filelist_remote_tab_dir);

    localFileListView = (ListView) findViewById(R.id.explorer_filelist_local_tab_listview);
    remoteFileListView = (ListView) findViewById(R.id.explorer_filelist_remote_tab_listview);
    localFileListEmptyView = (TextView) findViewById(R.id.explorer_filelist_local_empty_view);
    remoteFileListEmptyView = (TextView) findViewById(R.id.explorer_filelist_remote_empty_view);
    localFileListPathBtn = (Button) findViewById(R.id.explorer_filelist_local_filepath);
    localFileListUpBtn = (Button) findViewById(R.id.explorer_filelist_local_up_btn);
    localFileListTopBtn = (Button) findViewById(R.id.explorer_filelist_local_top_btn);
    localFileListPasteBtn = (Button) findViewById(R.id.explorer_filelist_local_paste_btn);
    localFileListCreateBtn = (Button) findViewById(R.id.explorer_filelist_local_create_btn);
    localFileListReloadBtn = (Button) findViewById(R.id.explorer_filelist_local_reload_btn);

    remoteFileListPathBtn = (Button) findViewById(R.id.explorer_filelist_remote_filepath);
    remoteFileListUpBtn = (Button) findViewById(R.id.explorer_filelist_remote_up_btn);
    remoteFileListTopBtn = (Button) findViewById(R.id.explorer_filelist_remote_top_btn);
    remoteFileListPasteBtn = (Button) findViewById(R.id.explorer_filelist_remote_paste_btn);
    remoteFileListCreateBtn = (Button) findViewById(R.id.explorer_filelist_remote_create_btn);
    remoteFileListReloadBtn = (Button) findViewById(R.id.explorer_filelist_remote_reload_btn);

    mLocalProgressMsg = (TextView) findViewById(R.id.explorer_filelist_local_progress_msg);
    mLocalProgressCancel = (Button) findViewById(R.id.explorer_filelist_local_progress_cancel);
    mRemoteProgressMsg = (TextView) findViewById(R.id.explorer_filelist_remote_progress_msg);
    mRemoteProgressCancel = (Button) findViewById(R.id.explorer_filelist_remote_progress_cancel);
    mGp.progressMsgView = null;
    mGp.progressCancelBtn = null;
    mGp.dialogMsgView = null;

    mLocalProgressView = (LinearLayout) findViewById(R.id.explorer_filelist_local_progress);
    mRemoteProgressView = (LinearLayout) findViewById(R.id.explorer_filelist_remote_progress);
    mLocalDialogView = (LinearLayout) findViewById(R.id.explorer_filelist_local_dialog);
    mRemoteDialogView = (LinearLayout) findViewById(R.id.explorer_filelist_remote_dialog);

    mLocalDialogMsg = (TextView) findViewById(R.id.explorer_filelist_local_dialog_msg);
    mLocalDialogCloseBtn = (Button) findViewById(R.id.explorer_filelist_local_dialog_close);
    mRemoteDialogMsg = (TextView) findViewById(R.id.explorer_filelist_remote_dialog_msg);
    mRemoteDialogCloseBtn = (Button) findViewById(R.id.explorer_filelist_remote_dialog_close);

    dialogBackgroundColor = mThemeColorList.window_background_color_content;
    //      if (mThemeColorList.theme_is_light) {
    //         dialogBackgroundColor=Color.LTGRAY;
    //         dialogBackgroundColor=mThemeColorList.window_color_backgroun;
    //      } else {
    //         if (Build.VERSION.SDK_INT==10) dialogBackgroundColor=Color.BLACK;
    //         else if (Build.VERSION.SDK_INT==19) dialogBackgroundColor=0xff181818; //4.4
    //         else if (Build.VERSION.SDK_INT==18) dialogBackgroundColor=0xff101010; //4.3
    //         else dialogBackgroundColor=0xff101010; //Other
    //      }

    setPasteButtonEnabled();
}

From source file:com.sentaroh.android.SMBSync2.ActivityMain.java

@SuppressLint("InflateParams")
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void createTabView() {
    mMainTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mMainTabHost.setup();/*from ww  w . j  a  v a 2 s  . com*/
    mMainTabWidget = (TabWidget) findViewById(android.R.id.tabs);

    if (Build.VERSION.SDK_INT >= 11) {
        mMainTabWidget.setStripEnabled(false);
        mMainTabWidget.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    }

    CustomTabContentView tabViewProf = new CustomTabContentView(this, getString(R.string.msgs_tab_name_prof));
    mMainTabHost.addTab(mMainTabHost.newTabSpec(SMBSYNC_TAB_NAME_TASK).setIndicator(tabViewProf)
            .setContent(android.R.id.tabcontent));

    CustomTabContentView tabViewHist = new CustomTabContentView(this,
            getString(R.string.msgs_tab_name_history));
    mMainTabHost.addTab(mMainTabHost.newTabSpec(SMBSYNC_TAB_NAME_HIST).setIndicator(tabViewHist)
            .setContent(android.R.id.tabcontent));

    CustomTabContentView tabViewMsg = new CustomTabContentView(this, getString(R.string.msgs_tab_name_msg));
    mMainTabHost.addTab(mMainTabHost.newTabSpec(SMBSYNC_TAB_NAME_STATUS).setIndicator(tabViewMsg)
            .setContent(android.R.id.tabcontent));

    LinearLayout ll_main = (LinearLayout) findViewById(R.id.main_view);
    ll_main.setBackgroundColor(mGp.themeColorList.window_background_color_content);

    LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mProfileView = (LinearLayout) vi.inflate(R.layout.main_profile, null);
    mProfileView.setBackgroundColor(mGp.themeColorList.window_background_color_content);
    mHistoryView = (LinearLayout) vi.inflate(R.layout.main_history, null);
    mHistoryView.setBackgroundColor(mGp.themeColorList.window_background_color_content);
    mMessageView = (LinearLayout) vi.inflate(R.layout.main_msg, null);
    mMessageView.setBackgroundColor(mGp.themeColorList.window_background_color_content);

    mGp.msgListView = (ListView) mMessageView.findViewById(R.id.main_msg_view_list);
    mGp.syncTaskListView = (ListView) mProfileView.findViewById(R.id.main_profile_view_list);
    mGp.syncHistoryListView = (ListView) mHistoryView.findViewById(R.id.main_history_list);

    mGp.scheduleInfoView = (TextView) findViewById(R.id.main_schedule_view_info);
    mGp.scheduleInfoView.setTextColor(mGp.themeColorList.text_color_primary);

    mGp.confirmView = (LinearLayout) findViewById(R.id.main_dialog_confirm_view);
    mGp.confirmView.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color);
    mGp.confirmView.setVisibility(LinearLayout.GONE);
    mGp.confirmMsg = (TextView) findViewById(R.id.main_dialog_confirm_msg);
    mGp.confirmMsg.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.confirmCancel = (Button) findViewById(R.id.main_dialog_confirm_sync_cancel);
    setButtonColor(mGp.confirmCancel);
    if (mGp.themeColorList.theme_is_light)
        mGp.confirmCancel.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.confirmYes = (Button) findViewById(R.id.copy_delete_confirm_yes);
    setButtonColor(mGp.confirmYes);
    mGp.confirmYes.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.confirmNo = (Button) findViewById(R.id.copy_delete_confirm_no);
    setButtonColor(mGp.confirmNo);
    mGp.confirmNo.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.confirmYesAll = (Button) findViewById(R.id.copy_delete_confirm_yesall);
    setButtonColor(mGp.confirmYesAll);
    mGp.confirmYesAll.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.confirmNoAll = (Button) findViewById(R.id.copy_delete_confirm_noall);
    setButtonColor(mGp.confirmNoAll);
    mGp.confirmNoAll.setTextColor(mGp.themeColorList.text_color_primary);

    mGp.progressBarView = (LinearLayout) findViewById(R.id.main_dialog_progress_bar_view);
    mGp.progressBarView.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color);
    mGp.progressBarView.setVisibility(LinearLayout.GONE);
    mGp.progressBarMsg = (TextView) findViewById(R.id.main_dialog_progress_bar_msg);
    mGp.progressBarMsg.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.progressBarPb = (ProgressBar) findViewById(R.id.main_dialog_progress_bar_progress);

    mGp.progressBarCancel = (Button) findViewById(R.id.main_dialog_progress_bar_btn_cancel);
    setButtonColor(mGp.progressBarCancel);
    if (mGp.themeColorList.theme_is_light)
        mGp.progressBarCancel.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.progressBarImmed = (Button) findViewById(R.id.main_dialog_progress_bar_btn_immediate);
    setButtonColor(mGp.progressBarImmed);
    if (mGp.themeColorList.theme_is_light)
        mGp.progressBarImmed.setTextColor(mGp.themeColorList.text_color_primary);

    mGp.progressSpinView = (LinearLayout) findViewById(R.id.main_dialog_progress_spin_view);
    mGp.progressSpinView.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color);
    mGp.progressSpinView.setVisibility(LinearLayout.GONE);
    mGp.progressSpinSyncprof = (TextView) findViewById(R.id.main_dialog_progress_spin_syncprof);
    mGp.progressSpinSyncprof.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.progressSpinMsg = (TextView) findViewById(R.id.main_dialog_progress_spin_syncmsg);
    mGp.progressSpinMsg.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.progressSpinCancel = (Button) findViewById(R.id.main_dialog_progress_spin_btn_cancel);
    setButtonColor(mGp.progressSpinCancel);
    if (mGp.themeColorList.theme_is_light)
        mGp.progressSpinCancel.setTextColor(mGp.themeColorList.text_color_primary);

    createContextView();

    mMainViewPagerAdapter = new CustomViewPagerAdapter(this,
            new View[] { mProfileView, mHistoryView, mMessageView });
    mMainViewPager = (CustomViewPager) findViewById(R.id.main_view_pager);
    //       mMainViewPager.setBackgroundColor(mThemeColorList.window_color_background);
    mMainViewPager.setAdapter(mMainViewPagerAdapter);
    mMainViewPager.setOnPageChangeListener(new MainPageChangeListener());
    if (restartType == NORMAL_START) {
        mMainTabHost.setCurrentTabByTag(SMBSYNC_TAB_NAME_TASK);
        mMainViewPager.setCurrentItem(0);
    }
    mMainTabHost.setOnTabChangedListener(new MainOnTabChange());

}

From source file:com.sentaroh.android.SMBSync2.ActivityMain.java

@SuppressLint("InflateParams")
private void aboutSMBSync() {
    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.about_dialog);

    final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.about_dialog_title_view);
    final TextView title = (TextView) dialog.findViewById(R.id.about_dialog_title);
    title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color);
    title.setTextColor(mGp.themeColorList.text_color_dialog_title);
    title.setText(getString(R.string.msgs_dlg_title_about) + "(Ver " + packageVersionName + ")");

    // get our tabHost from the xml
    final TabHost tab_host = (TabHost) dialog.findViewById(R.id.about_tab_host);
    tab_host.setup();/*w  w w. j  a va  2 s  . co  m*/

    final TabWidget tab_widget = (TabWidget) dialog.findViewById(android.R.id.tabs);

    if (Build.VERSION.SDK_INT >= 11) {
        tab_widget.setStripEnabled(false);
        tab_widget.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    }

    CustomTabContentView tabViewProf = new CustomTabContentView(this,
            getString(R.string.msgs_about_dlg_func_btn));
    tab_host.addTab(tab_host.newTabSpec("func").setIndicator(tabViewProf).setContent(android.R.id.tabcontent));

    CustomTabContentView tabViewHist = new CustomTabContentView(this,
            getString(R.string.msgs_about_dlg_change_btn));
    tab_host.addTab(
            tab_host.newTabSpec("change").setIndicator(tabViewHist).setContent(android.R.id.tabcontent));

    LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout ll_func = (LinearLayout) vi.inflate(R.layout.about_dialog_func, null);
    LinearLayout ll_change = (LinearLayout) vi.inflate(R.layout.about_dialog_change, null);

    final WebView func_view = (WebView) ll_func.findViewById(R.id.about_dialog_function);
    func_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_dlg_title_about_func_desc));
    func_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    func_view.getSettings().setBuiltInZoomControls(true);

    final WebView change_view = (WebView) ll_change.findViewById(R.id.about_dialog_change_history);
    change_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_dlg_title_about_change_desc));
    change_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    change_view.getSettings().setBuiltInZoomControls(true);

    final CustomViewPagerAdapter mAboutViewPagerAdapter = new CustomViewPagerAdapter(this,
            new WebView[] { func_view, change_view });
    final CustomViewPager mAboutViewPager = (CustomViewPager) dialog.findViewById(R.id.about_view_pager);
    //       mMainViewPager.setBackgroundColor(mThemeColorList.window_color_background);
    mAboutViewPager.setAdapter(mAboutViewPagerAdapter);
    mAboutViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            //             util.addDebugMsg(2,"I","onPageSelected entered, pos="+position);
            tab_widget.setCurrentTab(position);
            tab_host.setCurrentTab(position);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
            //             util.addDebugMsg(2,"I","onPageScrollStateChanged entered, state="+state);
        }

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            //             util.addDebugMsg(2,"I","onPageScrolled entered, pos="+position);
        }
    });

    tab_host.setOnTabChangedListener(new OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            util.addDebugMsg(2, "I", "onTabchanged entered. tab=" + tabId);
            mAboutViewPager.setCurrentItem(tab_host.getCurrentTab());
        }
    });

    final Button btnOk = (Button) dialog.findViewById(R.id.about_dialog_btn_ok);

    CommonDialog.setDlgBoxSizeLimit(dialog, true);

    // OK?
    btnOk.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
    // Cancel?
    dialog.setOnCancelListener(new Dialog.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface arg0) {
            btnOk.performClick();
        }
    });

    dialog.show();
}