Example usage for android.widget RelativeLayout TRUE

List of usage examples for android.widget RelativeLayout TRUE

Introduction

In this page you can find the example usage for android.widget RelativeLayout TRUE.

Prototype

int TRUE

To view the source code for android.widget RelativeLayout TRUE.

Click Source Link

Usage

From source file:com.turingtechnologies.materialscrollbar.Indicator.java

void linkToScrollBar(MaterialScrollBar materialScrollBar) {
    if (Build.VERSION.SDK_INT >= 16) {
        setBackground(ContextCompat.getDrawable(context, R.drawable.indicator));
    } else {//from   w ww .  j  a  v  a 2  s .  c om
        setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.indicator));
    }
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(Utils.getDP(getIndicatorWidth(), this),
            Utils.getDP(getIndicatorHeight(), this));
    lp.setMargins(0, 0, Utils.getDP(8, this), 0);
    setVisibility(INVISIBLE);

    textView = new TextView(context);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, getTextSize());
    RelativeLayout.LayoutParams tvlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    tvlp.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);

    addView(textView, tvlp);

    ((GradientDrawable) getBackground()).setColor(materialScrollBar.handleColour);

    lp.addRule(ALIGN_RIGHT, materialScrollBar.getId());
    ((ViewGroup) materialScrollBar.getParent()).addView(this, lp);
}

From source file:com.robopupu.feature.about.view.LicensesInfoFragment.java

@Override
protected void onCreateBindings() {
    super.onCreateBindings();

    webView = new WebView(getActivity());

    webViewRelativeLayout = getView(R.id.relative_layout_web_view);
    webViewClient = new DelegatedWebViewClient(presenter);
    webView.setWebViewClient(webViewClient);

    final RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    webViewRelativeLayout.addView(webView, params);

    new ClickBinding(this, R.id.button_ok) {
        @Override//w  ww  .  ja  v  a 2 s  .co  m
        protected void clicked() {
            // REMOVE presenter.onOkButtonClick();
        }
    };
}

From source file:org.telegram.ui.ChangePhoneHelpActivity.java

@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);

    TLRPC.User user = UserConfig.getCurrentUser();
    String value;//from w w  w.  ja v  a2s  . c o m
    if (user != null && user.phone != null && user.phone.length() != 0) {
        value = PhoneFormat.getInstance().format("+" + user.phone);
    } else {
        value = LocaleController.getString("NumberUnknown", R.string.NumberUnknown);
    }

    actionBar.setTitle(value);
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    fragmentView = new RelativeLayout(context);
    fragmentView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return true;
        }
    });

    RelativeLayout relativeLayout = (RelativeLayout) fragmentView;

    ScrollView scrollView = new ScrollView(context);
    relativeLayout.addView(scrollView);
    RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) scrollView.getLayoutParams();
    layoutParams3.width = LayoutHelper.MATCH_PARENT;
    layoutParams3.height = LayoutHelper.WRAP_CONTENT;
    layoutParams3.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
    scrollView.setLayoutParams(layoutParams3);

    LinearLayout linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setPadding(0, AndroidUtilities.dp(20), 0, AndroidUtilities.dp(20));
    scrollView.addView(linearLayout);
    ScrollView.LayoutParams layoutParams = (ScrollView.LayoutParams) linearLayout.getLayoutParams();
    layoutParams.width = ScrollView.LayoutParams.MATCH_PARENT;
    layoutParams.height = ScrollView.LayoutParams.WRAP_CONTENT;
    linearLayout.setLayoutParams(layoutParams);

    ImageView imageView = new ImageView(context);
    imageView.setImageResource(R.drawable.phone_change);
    linearLayout.addView(imageView);
    LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) imageView.getLayoutParams();
    layoutParams2.width = LayoutHelper.WRAP_CONTENT;
    layoutParams2.height = LayoutHelper.WRAP_CONTENT;
    layoutParams2.gravity = Gravity.CENTER_HORIZONTAL;
    imageView.setLayoutParams(layoutParams2);

    TextView textView = new TextView(context);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setGravity(Gravity.CENTER_HORIZONTAL);
    //textView.setTextColor(0xff212121);

    try {
        textView.setText(AndroidUtilities
                .replaceTags(LocaleController.getString("PhoneNumberHelp", R.string.PhoneNumberHelp)));
    } catch (Exception e) {
        FileLog.e("tmessages", e);
        textView.setText(LocaleController.getString("PhoneNumberHelp", R.string.PhoneNumberHelp));
    }
    linearLayout.addView(textView);
    layoutParams2 = (LinearLayout.LayoutParams) textView.getLayoutParams();
    layoutParams2.width = LayoutHelper.WRAP_CONTENT;
    layoutParams2.height = LayoutHelper.WRAP_CONTENT;
    layoutParams2.gravity = Gravity.CENTER_HORIZONTAL;
    layoutParams2.leftMargin = AndroidUtilities.dp(20);
    layoutParams2.rightMargin = AndroidUtilities.dp(20);
    layoutParams2.topMargin = AndroidUtilities.dp(56);
    textView.setLayoutParams(layoutParams2);

    textView = new TextView(context);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    textView.setGravity(Gravity.CENTER_HORIZONTAL);
    textView.setTextColor(ContextCompat.getColor(context, R.color.colorAccent) /*0xff4d83b3*/);
    textView.setText(LocaleController.getString("PhoneNumberChange", R.string.PhoneNumberChange));
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setPadding(AndroidUtilities.dp(16), AndroidUtilities.dp(12), AndroidUtilities.dp(16),
            AndroidUtilities.dp(12));
    textView.setBackground(context.getDrawable(R.drawable.list_selector));
    linearLayout.addView(textView);
    layoutParams2 = (LinearLayout.LayoutParams) textView.getLayoutParams();
    layoutParams2.width = LayoutHelper.WRAP_CONTENT;
    layoutParams2.height = LayoutHelper.WRAP_CONTENT;
    layoutParams2.gravity = Gravity.CENTER_HORIZONTAL;
    layoutParams2.leftMargin = AndroidUtilities.dp(20);
    layoutParams2.rightMargin = AndroidUtilities.dp(20);
    layoutParams2.topMargin = AndroidUtilities.dp(46);
    textView.setLayoutParams(layoutParams2);

    textView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (getParentActivity() == null) {
                return;
            }
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
            builder.setMessage(LocaleController.getString("PhoneNumberAlert", R.string.PhoneNumberAlert));
            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK),
                    new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            presentFragment(new ChangePhoneActivity(), true);
                        }
                    });
            builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
            showDialog(builder.create());
        }
    });

    return fragmentView;
}

From source file:com.github.shareme.gwsmaterialuikit.library.mscrollbar.Indicator.java

void linkToScrollBar(MaterialScrollBar msb, boolean addSpace) {
    this.addSpace = addSpace;
    if (Build.VERSION.SDK_INT >= 16) {
        setBackground(ContextCompat.getDrawable(context, R.drawable.mscrollbar_indicator));
    } else {/*  ww w  .ja  v  a2 s  . c  o m*/
        setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.mscrollbar_indicator));
    }
    LayoutParams lp = new LayoutParams(Utils.getDP(getIndicatorWidth(), this),
            Utils.getDP(getIndicatorHeight(), this));
    if (addSpace) {
        lp.setMargins(0, 0, Utils.getDP(15, this) + msb.handle.getWidth(), 0);
    } else {
        lp.setMargins(0, 0, Utils.getDP(2, this) + msb.handle.getWidth(), 0);
    }

    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, getTextSize());
    LayoutParams tvlp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    tvlp.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);

    addView(textView, tvlp);

    ((GradientDrawable) getBackground()).setColor(msb.handleColour);

    lp.addRule(ALIGN_RIGHT, msb.getId());
    ((ViewGroup) msb.getParent()).addView(this, lp);

    materialScrollBar = msb;
}

From source file:com.bluekai.sdk.BlueKaiViewDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
    if (blueKaiView == null) {
        blueKaiView = new WebView(getActivity());
        WebViewClient client = new WebViewClient() {
            @Override//  w  w w .j  a  v a 2s.c  o m
            public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                super.onReceivedError(view, errorCode, description, failingUrl);
                Logger.debug("BlueKaiView",
                        "Error loading BK URL in webview -- " + errorCode + " -- " + description);
                errorOccured = true;
                if (listener != null) {
                    listener.onViewLoaded(false, isExistingData(), getParamsList());
                }
            }

            @Override
            public void onPageFinished(WebView view, String url) {
                super.onPageFinished(view, url);
                if (!errorOccured && listener != null) {
                    errorOccured = false;
                    listener.onViewLoaded(true, isExistingData(), getParamsList());
                }
            }
        };
        blueKaiView.setWebViewClient(client);
        WebSettings webSettings = blueKaiView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        int height = 1, width = 1;
        // if (devMode) {
        height = width = 300;
        // }
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(width, height);
        params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
        params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
        params.setMargins(10, 10, 10, 10);
        blueKaiView.setLayoutParams(params);
        blueKaiView.setBackgroundColor(Color.LTGRAY);
        alertDialogBuilder.setNegativeButton("Close", new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
    }
    blueKaiView.loadUrl(url);
    alertDialogBuilder.setView(blueKaiView);
    return alertDialogBuilder.create();
}

From source file:com.ab.activity.AbActivity.java

/**
 * ??./*from   w w  w . j a  v  a  2s . co m*/
 *
 * @param savedInstanceState the saved instance state
 * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle)
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    mInflater = LayoutInflater.from(this);

    //?
    mAbTitleBar = new AbTitleBar(this);

    //
    ab_base = new RelativeLayout(this);
    ab_base.setBackgroundColor(Color.rgb(255, 255, 255));

    //
    contentLayout = new RelativeLayout(this);
    contentLayout.setPadding(0, 0, 0, 0);

    //?
    mAbBottomBar = new AbBottomBar(this);

    //View
    ab_base.addView(mAbTitleBar,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    mAbTitleBar.setVisibility(View.GONE);

    RelativeLayout.LayoutParams layoutParamsBottomBar = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParamsBottomBar.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    ab_base.addView(mAbBottomBar, layoutParamsBottomBar);

    RelativeLayout.LayoutParams layoutParamsContent = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParamsContent.addRule(RelativeLayout.BELOW, mAbTitleBar.getId());
    layoutParamsContent.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId());
    ab_base.addView(contentLayout, layoutParamsContent);

    //Application?
    abApplication = getApplication();

    //ContentView
    setContentView(ab_base,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}

From source file:com.bangqu.eshow.activity.ESActivity.java

/**
 * ??.//from w w  w.j  ava 2s.  c  o m
 *
 * @param savedInstanceState the saved instance state
 * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle)
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    mInflater = LayoutInflater.from(this);

    //?
    mAbTitleBar = new ESTitleBar(this);

    //
    ab_base = new RelativeLayout(this);
    ab_base.setBackgroundColor(Color.rgb(255, 255, 255));

    //
    contentLayout = new RelativeLayout(this);
    contentLayout.setPadding(0, 0, 0, 0);

    //?
    mAbBottomBar = new ESBottomBar(this);

    //View
    ab_base.addView(mAbTitleBar,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    mAbTitleBar.setVisibility(View.GONE);

    RelativeLayout.LayoutParams layoutParamsBottomBar = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParamsBottomBar.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    ab_base.addView(mAbBottomBar, layoutParamsBottomBar);

    RelativeLayout.LayoutParams layoutParamsContent = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParamsContent.addRule(RelativeLayout.BELOW, mAbTitleBar.getId());
    layoutParamsContent.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId());
    ab_base.addView(contentLayout, layoutParamsContent);

    //Application?
    abApplication = getApplication();

    //ContentView
    setContentView(ab_base,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

    ESActivityManager.getInstance().addActivity(this);
}

From source file:cn.org.eshow.framwork.activity.AbActivity.java

/**
 * ??.//ww w . j av a  2s . c o m
 *
 * @param savedInstanceState the saved instance state
 * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle)
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    mInflater = LayoutInflater.from(this);

    //?
    mAbTitleBar = new AbTitleBar(this);

    //
    ab_base = new RelativeLayout(this);
    ab_base.setBackgroundColor(Color.rgb(255, 255, 255));

    //
    contentLayout = new RelativeLayout(this);
    contentLayout.setPadding(0, 0, 0, 0);

    //?
    mAbBottomBar = new AbBottomBar(this);

    //View
    ab_base.addView(mAbTitleBar,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    mAbTitleBar.setVisibility(View.GONE);

    RelativeLayout.LayoutParams layoutParamsBottomBar = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParamsBottomBar.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    ab_base.addView(mAbBottomBar, layoutParamsBottomBar);

    RelativeLayout.LayoutParams layoutParamsContent = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParamsContent.addRule(RelativeLayout.BELOW, mAbTitleBar.getId());
    layoutParamsContent.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId());
    ab_base.addView(contentLayout, layoutParamsContent);

    //Application?
    abApplication = getApplication();

    //ContentView
    setContentView(ab_base,
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

    AbActivityManager.getInstance().addActivity(this);
}

From source file:org.projectbuendia.client.ui.ProgressFragment.java

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    mFrame = new RelativeLayout(getActivity());
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
    mFrame.setLayoutParams(layoutParams);

    RelativeLayout.LayoutParams relativeLayout = new RelativeLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    relativeLayout.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    mIndeterminateProgressBar = new ProgressBar(getActivity());
    mIndeterminateProgressBar.setLayoutParams(relativeLayout);

    mProgressBarLayout = inflater.inflate(R.layout.progress_fragment_measured_progress_view, null);
    mProgressBarLayout.setLayoutParams(relativeLayout);
    mProgressBar = (ProgressBar) mProgressBarLayout.findViewById(R.id.progress_fragment_progress_bar);
    mProgressBarLabel = (TextView) mProgressBarLayout.findViewById(R.id.progress_fragment_label);

    RelativeLayout.LayoutParams fullLayout = new RelativeLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
    fullLayout.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    mErrorTextView = new TextView(getActivity());
    mErrorTextView.setLayoutParams(fullLayout);
    mErrorTextView.setGravity(Gravity.CENTER);

    mContent.setVisibility(View.GONE);
    mProgressBarLayout.setVisibility(View.GONE);
    mFrame.addView(mIndeterminateProgressBar);
    mFrame.addView(mProgressBarLayout);//from  w  w  w.j  a v  a  2  s.c  o  m
    mFrame.addView(mContent);
    mFrame.addView(mErrorTextView);
    return mFrame;
}

From source file:klawisch.jimdo.statistics.statisticsdemo.MainActivity.java

private void initProgressBar() {
    layout = (RelativeLayout) findViewById(R.id.relativeLayout);
    customProgressBar = new CustomProgressBar(this);
    customProgressBar.setColor(Color.parseColor("#0097df"));
    customProgressBar.setStrokeWidth(20);
    customProgressBar.setDiameter(500);//  w w w  .  j  a  v  a2s .c  om
    //        customProgressBar.setLogProgress(true);

    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    customProgressBar.setLayoutParams(params);
}