Example usage for android.view Gravity CENTER_VERTICAL

List of usage examples for android.view Gravity CENTER_VERTICAL

Introduction

In this page you can find the example usage for android.view Gravity CENTER_VERTICAL.

Prototype

int CENTER_VERTICAL

To view the source code for android.view Gravity CENTER_VERTICAL.

Click Source Link

Document

Place object in the vertical center of its container, not changing its size.

Usage

From source file:com.android.tabletcustomui.views.LeftCircleContainer.java

private void init(Context context, int width) {

    LinearLayoutCompat.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams((int) (width),
            (int) (width));
    layoutParams.gravity = Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL;
    this.setLayoutParams(layoutParams);

    LeftOuterCircleView leftOuterCircleView1 = new LeftOuterCircleView(context, width, false);
    LeftOuterCircleView leftOuterCircleView2 = new LeftOuterCircleView(context, (width - 40), true);

    circleTitleView = new CircleTitleView(context, (int) (width));
    circleTitleView.setTextColor(getContext().getResources().getColor(android.R.color.white));
    circleTitleView.setTextSize(20);//w  w w . ja  va 2 s.  c o  m
    circleTitleView.setTypeface(Typeface.DEFAULT, Typeface.BOLD_ITALIC);
    circleTitleView.setText("App Name");

    this.addView(leftOuterCircleView1);
    this.addView(leftOuterCircleView2);
    addCircle(1, width - 78, (float) 0.0, 0.85);
    addCircle(2, width - 150, (float) 0.0, 0.97);
    addCircle(3, width - 170, (float) 0.0, 0.97);
    addCircle(4, width - 190, (float) 0.0, 0.98);
    addCircle(5, width - 210, (float) 0.0, 0.98);
    addCircle(6, width - 230, (float) 0.0, 0.85);
    addCircle(7, width - 280, (float) 0.0, 0.85);
    addCircle(0, width - 35, (float) 0.0, 0.9);
    addCircle(0, width - 92, (float) 0.1, 0.9);

    this.addView(circleTitleView);

    animateClockWise(leftOuterCircleView1);

    animateAntiClockWise(leftOuterCircleView2);

}

From source file:ovh.ice.icecons.MainActivity.java

private void createLayout() {

    // main centered layout

    LinearLayout.LayoutParams smallLayoutParams = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1f);
    float scale = IceScreenUtils.densityScale(getApplicationContext());
    ViewGroup.LayoutParams buttonParams = new ViewGroup.LayoutParams(Math.round(48 * scale),
            Math.round(48 * scale));

    LinearLayout frameLayout = new LinearLayout(this);
    frameLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.MATCH_PARENT));
    frameLayout.setBackgroundColor(0xffffffff);
    frameLayout.setGravity(Gravity.CENTER);
    setContentView(frameLayout);//w w w.j a v a  2 s . com

    LinearLayout baseLayout = new LinearLayout(this);
    baseLayout.setOrientation(LinearLayout.VERTICAL);
    baseLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.MATCH_PARENT));
    baseLayout.setGravity(Gravity.LEFT);
    frameLayout.addView(baseLayout);

    // wallpaper button

    LinearLayout wallpaperLayout = new LinearLayout(this);
    wallpaperLayout.setOrientation(LinearLayout.HORIZONTAL);
    wallpaperLayout.setLayoutParams(smallLayoutParams);
    wallpaperLayout.setGravity(Gravity.CENTER_VERTICAL);
    baseLayout.addView(wallpaperLayout);

    LinearLayout wallpaperClickLayout = new LinearLayout(this);
    wallpaperClickLayout.setOrientation(LinearLayout.HORIZONTAL);
    wallpaperClickLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    wallpaperClickLayout.setGravity(Gravity.CENTER);
    wallpaperLayout.addView(wallpaperClickLayout);
    wallpaperClickLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            wallpaperPicker(v);
        }
    });

    Button wallpaperButton = new Button(this);
    wallpaperButton.setLayoutParams(buttonParams);
    wallpaperButton.setBackground(
            new BitmapDrawable(getResources(), IceImageUtils.bitmapLoad(getApplicationContext().getResources(),
                    R.drawable.ic_wallpaper_button, Math.round(48 * scale), Math.round(48 * scale))));
    wallpaperClickLayout.addView(wallpaperButton);

    TextView wallpaperText = new TextView(this);
    wallpaperText.setText("wallpapers");
    wallpaperText.setTextSize(24);
    wallpaperText.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimaryDark));
    wallpaperText.setPadding(64, 64, 64, 64);
    wallpaperClickLayout.addView(wallpaperText);

    // icon view button

    LinearLayout iconLayout = new LinearLayout(this);
    iconLayout.setOrientation(LinearLayout.HORIZONTAL);
    iconLayout.setLayoutParams(smallLayoutParams);
    iconLayout.setGravity(Gravity.CENTER_VERTICAL);
    baseLayout.addView(iconLayout);

    LinearLayout iconClickLayout = new LinearLayout(this);
    iconClickLayout.setOrientation(LinearLayout.HORIZONTAL);
    iconClickLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    iconClickLayout.setGravity(Gravity.CENTER);
    iconLayout.addView(iconClickLayout);
    iconClickLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            iconView(v);
        }
    });

    Button iconButton = new Button(this);
    iconButton.setLayoutParams(buttonParams);
    iconButton.setBackground(
            new BitmapDrawable(getResources(), IceImageUtils.bitmapLoad(getApplicationContext().getResources(),
                    R.drawable.ic_icon_button, Math.round(48 * scale), Math.round(48 * scale))));
    iconClickLayout.addView(iconButton);

    TextView iconText = new TextView(this);
    iconText.setText("view icons");
    iconText.setTextSize(24);
    iconText.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimaryDark));
    iconText.setPadding(64, 64, 64, 64);
    iconClickLayout.addView(iconText);

    // source code button

    LinearLayout sourceLayout = new LinearLayout(this);
    sourceLayout.setOrientation(LinearLayout.HORIZONTAL);
    sourceLayout.setLayoutParams(smallLayoutParams);
    sourceLayout.setGravity(Gravity.CENTER_VERTICAL);
    baseLayout.addView(sourceLayout);

    LinearLayout sourceClickLayout = new LinearLayout(this);
    sourceClickLayout.setOrientation(LinearLayout.HORIZONTAL);
    sourceClickLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    sourceClickLayout.setGravity(Gravity.CENTER);
    sourceLayout.addView(sourceClickLayout);
    sourceClickLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            gitLink(v);
        }
    });

    Button sourceButton = new Button(this);
    sourceButton.setLayoutParams(buttonParams);
    sourceButton.setBackground(
            new BitmapDrawable(getResources(), IceImageUtils.bitmapLoad(getApplicationContext().getResources(),
                    R.drawable.ic_source_button, Math.round(48 * scale), Math.round(48 * scale))));
    sourceClickLayout.addView(sourceButton);

    TextView sourceText = new TextView(this);
    sourceText.setText("source code");
    sourceText.setTextSize(24);
    sourceText.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimaryDark));
    sourceText.setPadding(64, 64, 64, 64);
    sourceClickLayout.addView(sourceText);

    // license button

    LinearLayout aboutLayout = new LinearLayout(this);
    aboutLayout.setOrientation(LinearLayout.HORIZONTAL);
    aboutLayout.setLayoutParams(smallLayoutParams);
    aboutLayout.setGravity(Gravity.CENTER_VERTICAL);
    baseLayout.addView(aboutLayout);

    LinearLayout aboutClickLayout = new LinearLayout(this);
    aboutClickLayout.setOrientation(LinearLayout.HORIZONTAL);
    aboutClickLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    aboutClickLayout.setGravity(Gravity.CENTER);
    aboutLayout.addView(aboutClickLayout);
    aboutClickLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            licenseShow(v);
        }
    });

    Button aboutButton = new Button(this);
    aboutButton.setLayoutParams(buttonParams);
    aboutButton.setBackground(
            new BitmapDrawable(getResources(), IceImageUtils.bitmapLoad(getApplicationContext().getResources(),
                    R.drawable.ic_license_button, Math.round(48 * scale), Math.round(48 * scale))));
    aboutClickLayout.addView(aboutButton);

    TextView aboutText = new TextView(this);
    aboutText.setText("license");
    aboutText.setTextSize(24);
    aboutText.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimaryDark));
    aboutText.setPadding(64, 64, 64, 64);
    aboutClickLayout.addView(aboutText);

}

From source file:com.github.andrewlord1990.snackbarbuilder.SnackbarIconBuilder.java

private LayoutParams getIconViewLayoutParams() {
    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER_VERTICAL;
    params.weight = 0;//from   ww w.j a  va  2 s .co m
    MarginLayoutParamsCompat.setMarginStart(params, iconMarginStartPixels);
    MarginLayoutParamsCompat.setMarginEnd(params, iconMarginEndPixels);
    return params;
}

From source file:org.telegram.ui.Cells.RadioButtonCell.java

public RadioButtonCell(Context context) {
    super(context);

    setBackgroundColor(ContextCompat.getColor(context, R.color.card_background));
    setElevation(AndroidUtilities.dp(2));

    if (paint == null) {
        paint = new Paint();
        paint.setColor(ContextCompat.getColor(context, R.color.divider));
        paint.setStrokeWidth(1);// ww  w.  j ava 2s  .c  o  m
    }

    radioButton = new RadioButton(context);
    radioButton.setClickable(false);
    radioButton.setFocusable(false);
    radioButton.setBackground(null);
    radioButton.setScaleX(22f / 24);
    radioButton.setScaleY(22f / 24);
    //radioButton.setSize(AndroidUtilities.dp(20));
    //radioButton.setColor(0xffb3b3b3, 0xff37a9f0);
    addView(radioButton,
            LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT,
                    (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP,
                    (LocaleController.isRTL ? 0 : 12), 6, (LocaleController.isRTL ? 12 : 0), 0));

    textView = new TextView(context);
    textView.setTextColor(ContextCompat.getColor(context, R.color.primary_text));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
    addView(textView,
            LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT,
                    (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP,
                    (LocaleController.isRTL ? 17 : 51), 10, (LocaleController.isRTL ? 51 : 17), 0));

    valueTextView = new TextView(context);
    //valueTextView.setTextColor(0xff8a8a8a);
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    valueTextView.setLines(0);
    valueTextView.setMaxLines(0);
    valueTextView.setSingleLine(false);
    valueTextView.setPadding(0, 0, 0, AndroidUtilities.dp(12));
    addView(valueTextView,
            LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT,
                    (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP,
                    (LocaleController.isRTL ? 17 : 51), 35, (LocaleController.isRTL ? 51 : 17), 0));
}

From source file:com.endiansoftware.echo.remotewatch.GcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {

    /*/*from   ww w  .ja v  a  2  s  .com*/
       // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(),
        GcmIntentService.class.getName());
    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);
    */

    /*
    // ?    ?? .
    Intent popupIntent = new Intent(context, Popup.class)
        .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    //  .
    context.startActivity(popupIntent);
            
    */

    LinearLayout layout = new LinearLayout(context);
    //layout.setBackgroundResource(R.color.LightOrange);

    TextView tv = new TextView(context);
    // set the TextView properties like color, size etc
    tv.setTextColor(Color.RED);
    tv.setTextSize(15);

    tv.setGravity(Gravity.CENTER_VERTICAL);

    // set the text you want to show in  Toast
    tv.setText("My Custom Toast at Bottom of Screen");

    layout.addView(tv);

    Toast toast = new Toast(context); //context is object of Context write "this" if you are an Activity
    // Set The layout as Toast View
    toast.setView(layout);

    // Position you toast here toast position is 50 dp from bottom you can give any integral value
    toast.setGravity(Gravity.BOTTOM, 0, 50);
    toast.show();
}

From source file:com.gosuncn.core.ui.widget.ToolbarExtend.java

public void setTitleGravity(int titleGravity) {
    if (titleGravity == this.titleGravity) {
        return;//from w  w  w . jav  a 2  s .  c o  m
    }

    this.titleGravity = Gravity.CENTER_VERTICAL | titleGravity;
    changeTitleGravity();
}

From source file:org.telegram.ui.Cells.TextDetailCell.java

public TextDetailCell(Context context) {
    super(context);

    setElevation(AndroidUtilities.dp(2));
    setBackgroundColor(ContextCompat.getColor(context, R.color.card_background));

    textView = new TextView(context);
    textView.setTextColor(ContextCompat.getColor(context, R.color.primary_text));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);/*from  w w  w  . j ava  2s  .c om*/
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView,
            LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT,
                    LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 16 : 71, 10,
                    LocaleController.isRTL ? 71 : 16, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(0xff8a8a8a);
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView,
            LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT,
                    LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 16 : 71, 35,
                    LocaleController.isRTL ? 71 : 16, 0));

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(imageView,
            LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT,
                    (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL,
                    LocaleController.isRTL ? 0 : 16, 0, LocaleController.isRTL ? 16 : 0, 0));
}

From source file:am.project.x.business.drawables.combinationdrawable.CombinationDrawableActivity.java

@SuppressLint("RtlHardcoded")
@Override//from w ww  .  j a  v  a2  s .  c  om
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    switch (position) {
    default:
    case 0:
        drawable.setGravity(Gravity.CENTER);
        break;
    case 1:
        drawable.setGravity(Gravity.LEFT);
        break;
    case 2:
        drawable.setGravity(Gravity.CENTER_HORIZONTAL);
        break;
    case 3:
        drawable.setGravity(Gravity.RIGHT);
        break;
    case 4:
        drawable.setGravity(Gravity.CENTER_VERTICAL);
        break;
    case 5:
        drawable.setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
        break;
    case 6:
        drawable.setGravity(Gravity.BOTTOM);
        break;
    case 7:
        drawable.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
        break;
    case 8:
        drawable.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
        break;
    }
}

From source file:am.project.x.business.drawables.linedrawable.LineDrawableActivity.java

@SuppressLint("RtlHardcoded")
@Override//from  w  ww  .j a va2  s.c  om
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    switch (position) {
    default:
    case 0:
        drawable.setGravity(Gravity.BOTTOM);
        break;
    case 1:
        drawable.setGravity(Gravity.LEFT);
        break;
    case 2:
        drawable.setGravity(Gravity.TOP);
        break;
    case 3:
        drawable.setGravity(Gravity.RIGHT);
        break;
    case 4:
        drawable.setGravity(Gravity.CENTER_HORIZONTAL);
        break;
    case 5:
        drawable.setGravity(Gravity.CENTER_VERTICAL);
        break;
    case 6:
        drawable.setGravity(Gravity.TOP | Gravity.BOTTOM);
        break;
    case 7:
        drawable.setGravity(Gravity.LEFT | Gravity.RIGHT);
        break;
    }
}

From source file:org.telegram.ui.Cells.UserControlCell.java

public UserControlCell(Context context, int padding) {
    super(context);

    avatarImageView = new BackupImageView(context);
    avatarImageView.setRoundRadius(AndroidUtilities.dp(24));
    addView(avatarImageView);//from w  w  w. java  2s  .  c  o  m
    LayoutParams layoutParams = (LayoutParams) avatarImageView.getLayoutParams();
    layoutParams.width = AndroidUtilities.dp(48);
    layoutParams.height = AndroidUtilities.dp(48);
    layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT;
    layoutParams.leftMargin = LocaleController.isRTL ? 0 : AndroidUtilities.dp(16);
    layoutParams.rightMargin = LocaleController.isRTL ? AndroidUtilities.dp(padding) : 0;
    layoutParams.topMargin = AndroidUtilities.dp(8);
    avatarImageView.setLayoutParams(layoutParams);
    avatarDrawable = new AvatarDrawable();

    nameTextView = new TextView(context);
    nameTextView.setTextColor(0xff212121);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 17);
    nameTextView.setLines(1);
    nameTextView.setMaxLines(1);
    nameTextView.setSingleLine(true);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    nameTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
    addView(nameTextView);
    layoutParams = (LayoutParams) nameTextView.getLayoutParams();
    layoutParams.width = LayoutParams.WRAP_CONTENT;
    layoutParams.height = LayoutParams.WRAP_CONTENT;
    layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? RIGHT_MARGIN : (68));
    layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? (68) : RIGHT_MARGIN);
    layoutParams.topMargin = AndroidUtilities.dp(10.5f);
    layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT;
    nameTextView.setLayoutParams(layoutParams);

    messageTextView = new TextView(context);
    messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    messageTextView.setLines(1);
    messageTextView.setMaxLines(1);
    messageTextView.setSingleLine(true);
    messageTextView.setEllipsize(TextUtils.TruncateAt.END);
    messageTextView
            .setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
    addView(messageTextView);
    layoutParams = (LayoutParams) messageTextView.getLayoutParams();
    layoutParams.width = LayoutParams.WRAP_CONTENT;
    layoutParams.height = LayoutParams.WRAP_CONTENT;
    layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? RIGHT_MARGIN : (68));
    layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? (68) : RIGHT_MARGIN);
    layoutParams.topMargin = AndroidUtilities.dp(33.5f);
    layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT;
    messageTextView.setLayoutParams(layoutParams);

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(imageView);
    layoutParams = (LayoutParams) imageView.getLayoutParams();
    layoutParams.width = LayoutParams.WRAP_CONTENT;
    layoutParams.height = LayoutParams.WRAP_CONTENT;
    layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 16);
    layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 0);
    layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL;
    imageView.setLayoutParams(layoutParams);
    imageView.setVisibility(View.GONE);

    LinearLayout buttonContainer = new LinearLayout(context);
    addView(buttonContainer);
    layoutParams = (LayoutParams) buttonContainer.getLayoutParams();
    layoutParams.width = LinearLayout.LayoutParams.WRAP_CONTENT;
    layoutParams.height = AndroidUtilities.dp(60);
    layoutParams.rightMargin = AndroidUtilities.dp(16);
    layoutParams.gravity = (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL;
    buttonContainer.setLayoutParams(layoutParams);

    ApproveBtn = new TextView(context);
    ApproveBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.approve_bg));
    ApproveBtn.setTextColor(getResources().getColor(android.R.color.white));
    ApproveBtn.setText(getResources().getString(R.string.approve_join_group));
    buttonContainer.addView(ApproveBtn);
    LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) ApproveBtn.getLayoutParams();
    lp.width = AndroidUtilities.dp(0);
    lp.weight = 1;
    lp.height = LayoutParams.WRAP_CONTENT;
    lp.gravity = Gravity.CENTER_VERTICAL;
    lp.rightMargin = AndroidUtilities.dp(2);
    ApproveBtn.setLayoutParams(lp);
    ApproveBtn.setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8),
            AndroidUtilities.dp(8));

    IgnoreBtn = new TextView(context);
    IgnoreBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.ignore_bg));
    IgnoreBtn.setTextColor(getResources().getColor(android.R.color.white));
    IgnoreBtn.setText(getResources().getString(R.string.ignore_join_group));
    buttonContainer.addView(IgnoreBtn);
    lp = (LinearLayout.LayoutParams) IgnoreBtn.getLayoutParams();
    lp.width = AndroidUtilities.dp(0);
    lp.weight = 1;
    lp.height = LayoutParams.WRAP_CONTENT;
    lp.gravity = Gravity.CENTER_VERTICAL;
    lp.leftMargin = AndroidUtilities.dp(2);
    IgnoreBtn.setLayoutParams(lp);
    IgnoreBtn.setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8),
            AndroidUtilities.dp(8));
}