Example usage for android.widget LinearLayout setX

List of usage examples for android.widget LinearLayout setX

Introduction

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

Prototype

public void setX(float x) 

Source Link

Document

Sets the visual x position of this view, in pixels.

Usage

From source file:com.hackensack.umc.activity.ProfileSelfieActivity.java

private void showHelpView(LayoutInflater layoutInflater) {
    if (Util.gethelpboolean(this, Constant.HELP_PREF_PROFILE)) {
        Util.storehelpboolean(this, Constant.HELP_PREF_PROFILE, false);
        helpView = layoutInflater.inflate(R.layout.profile_help, null, false);
        helpLl = (RelativeLayout) helpView.findViewById(R.id.profile_help_ll);
        helpLl.setY(bottom);// w w w  .ja v a  2s  .  com
        TextView arrowTv = (TextView) helpView.findViewById(R.id.profile_help_arrow);
        arrowTv.setTypeface(Util.getArrowFont(this));
        int x = getWindowManager().getDefaultDisplay().getWidth() / 3 - right + 30;
        LinearLayout linearLayout = (LinearLayout) helpView.findViewById(R.id.layoutStepInstruction);
        linearLayout.setX(x);

        TextView arrowSteps = (TextView) helpView.findViewById(R.id.txtStepsArrow);
        arrowSteps.setTypeface(Util.getArrowFont(this));

        TextView txtCoatch = ((TextView) helpView.findViewById(R.id.txtCoachMarks));
        txtCoatch.setTypeface(Util.getFontSegoe(this));

        /* if ((getResources().getConfiguration().screenLayout &
            Configuration.SCREENLAYOUT_SIZE_MASK) ==
            Configuration.SCREENLAYOUT_SIZE_LARGE|| Configuration.SCREENLAYOUT_LAYOUTDIR_MASK==Configuration.SCREENLAYOUT_SIZE_NORMAL||Configuration.SCREENLAYOUT_LAYOUTDIR_MASK==Configuration.SCREENLAYOUT_SIZE_XLARGE||Configuration.SCREENLAYOUT_LAYOUTDIR_MASK==Configuration.SCREENLAYOUT_SIZE_UNDEFINED) {
        txtCoatch.setTypeface(Util.getFontSegoe(this));
        txtCoatch.setVisibility(View.VISIBLE);
                
         }else {
        txtCoatch.setVisibility(View.GONE);
         }*/
        int h = getWindowManager().getDefaultDisplay().getHeight();
        if (getWindowManager().getDefaultDisplay().getHeight() <= 800) {
            txtCoatch.setVisibility(View.GONE);
        }

        ((TextView) helpView.findViewById(R.id.profile_tap_tv)).setTypeface(Util.getFontSegoe(this));
        ((TextView) helpView.findViewById(R.id.profile_tap_tv_1)).setTypeface(Util.getFontSegoe(this));
        ((TextView) helpView.findViewById(R.id.profile_tap_tv_2)).setTypeface(Util.getFontSegoe(this));
        ((TextView) helpView.findViewById(R.id.profile_tap_tv_3)).setTypeface(Util.getFontSegoe(this));
        ((TextView) helpView.findViewById(R.id.tap_tv_dismiss)).setTypeface(Util.getFontSegoe(this));
        ((TextView) helpView.findViewById(R.id.txtCoachMarks)).setTypeface(Util.getFontSegoe(this));
        ((TextView) helpView.findViewById(R.id.txtSteps)).setTypeface(Util.getFontSegoe(this));

        // arrowTv.setX((left+right) / 2);

        TextView txtHelp = ((TextView) helpView.findViewById(R.id.profile_help_tv));
        txtHelp.setTypeface(Util.getFontSegoe(this));
        //txtHelp.setY(bottom);;

        //((TextView) helpView.findViewById(R.id.help_tv)).setX((left+right) / 4);
        RelativeLayout helpLayout = ((RelativeLayout) helpView.findViewById(R.id.profile_help_rl));
        helpLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                frameLayout.removeView(helpView);
            }
        });
        frameLayout.addView(helpView);
    }
}

From source file:com.example.volunteerhandbook.MainActivity.java

void loopNewBox(LinearLayout iBox) {
    if (lastone <= 1) {
        show_what_I_thought();/*from   ww  w.  j av  a  2  s  .co m*/
        return;
    }
    if (iTh > 3 * thoughts.length + 2) {
        lastone--;
        return;
    }
    float bH = (int) (1.2 * iBox.getHeight());
    iBox.removeAllViews();
    for (int i = 0; i < thoughts.length / 4; i++) {
        iBox.addView(toMove[iTh++ % thoughts.length]);
    }
    //toMove.setTranslationY(600);
    //container.addView(textBox);
    iBox.setX(20);
    iBox.setY(2 * bH);
    //hBox += iBox.getHeight();
    float startY = iBox.getY();
    endY = (-1) * bH;
    int duration = 20000;
    ValueAnimator bounceAnim = ObjectAnimator.ofFloat(iBox, "y", startY, endY);
    bounceAnim.setDuration(duration);
    bounceAnim.setInterpolator(new LinearInterpolator());
    final LinearLayout fBox = iBox;
    bounceAnim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            loopNewBox(fBox);
        }
    });
    bounceAnim.start();
}