Example usage for android.widget TabWidget getLayoutParams

List of usage examples for android.widget TabWidget getLayoutParams

Introduction

In this page you can find the example usage for android.widget TabWidget getLayoutParams.

Prototype

@ViewDebug.ExportedProperty(deepExport = true, prefix = "layout_")
public ViewGroup.LayoutParams getLayoutParams() 

Source Link

Document

Get the LayoutParams associated with this view.

Usage

From source file:mobisocial.musubi.ui.fragments.EulaFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.setContentView(R.layout.eula);

    //load the tabs
    mTabs = (TabHost) dialog.findViewById(android.R.id.tabhost);
    mTabs.setup();// w w  w  .j a va 2  s . c o  m

    TabSpec tab_one = mTabs.newTabSpec("eula_tab");
    tab_one.setContent(R.id.eula_body);
    tab_one.setIndicator("EULA");
    mTabs.addTab(tab_one);

    TabSpec tab_two = mTabs.newTabSpec("privacy_tab");
    tab_two.setContent(R.id.priv_body);
    tab_two.setIndicator("Privacy Policy");
    mTabs.addTab(tab_two);

    //work around lack of ability to control tab height from xml completely
    TabWidget tab_widget = (TabWidget) dialog.findViewById(android.R.id.tabs);
    mTabs.getTabWidget().getChildAt(0).getLayoutParams().height = tab_widget.getLayoutParams().height;
    mTabs.getTabWidget().getChildAt(1).getLayoutParams().height = tab_widget.getLayoutParams().height;

    //load the agreements
    mEulaScroll = (ScrollView) dialog.findViewById(R.id.eula_scroll);
    mLoading = (LinearLayout) dialog.findViewById(R.id.loading);
    mEulaBodyView = (TextView) dialog.findViewById(R.id.eula_body);
    mPrivacyBodyView = (TextView) dialog.findViewById(R.id.priv_body);

    mAcceptedCheckbox = (CheckBox) dialog.findViewById(R.id.eula_checkbox);
    mAcceptButton = (Button) dialog.findViewById(R.id.eula_accept);
    mRejectButton = (Button) dialog.findViewById(R.id.eula_reject);
    mEmailButton = (Button) dialog.findViewById(R.id.eula_email);
    mDismissButton = (Button) dialog.findViewById(R.id.eula_dismiss);
    mEulaAcceptArea = (LinearLayout) dialog.findViewById(R.id.eula_accept_area);

    mAcceptedCheckbox.setOnCheckedChangeListener(new OnAcceptToggle());
    mAcceptButton.setOnClickListener(new OnAccept());
    mRejectButton.setOnClickListener(new OnReject());
    mEmailButton.setOnClickListener(new OnEmail());
    mDismissButton.setOnClickListener(new OnDismiss());

    if (!mRequired) {
        mEulaAcceptArea.setVisibility(View.GONE);
        mAcceptButton.setVisibility(View.GONE);
        mRejectButton.setVisibility(View.GONE);
        mDismissButton.setVisibility(View.VISIBLE);
    } else {
        mEulaAcceptArea.setVisibility(View.VISIBLE);
        mAcceptButton.setVisibility(View.VISIBLE);
        mRejectButton.setVisibility(View.VISIBLE);
        mDismissButton.setVisibility(View.GONE);
    }

    mAcceptButton.setEnabled(mAcceptedCheckbox.isChecked());
    dialog.setTitle("Musubi Usage Agreements");
    dialog.setOnKeyListener(new OnKey());

    new AgreementLoader().execute();
    return dialog;
}