Search in sources :

Example 6 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project Anki-Android by Ramblurr.

the class EditFieldActivity method createSpareMenu.

private void createSpareMenu(LinearLayout linearLayout) {
    LayoutParams pars = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1);
    Button toTextButton = new Button(this);
    toTextButton.setText(gtxt(R.string.multimedia_editor_field_editing_text));
    toTextButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            toTextField();
        }
    });
    linearLayout.addView(toTextButton, pars);
    Button toImageButton = new Button(this);
    toImageButton.setText(gtxt(R.string.multimedia_editor_field_editing_image));
    toImageButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            toImageField();
        }
    });
    linearLayout.addView(toImageButton, pars);
    Button toAudioButton = new Button(this);
    toAudioButton.setText(gtxt(R.string.multimedia_editor_field_editing_audio));
    toAudioButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            toAudioField();
        }
    });
    linearLayout.addView(toAudioButton, pars);
    Button doneButton = new Button(this);
    doneButton.setText(gtxt(R.string.multimedia_editor_field_editing_done));
    doneButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            done();
        }
    });
    linearLayout.addView(doneButton, pars);
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) Button(android.widget.Button) View(android.view.View)

Example 7 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project gesture-imageview by jasonpolites.

the class StandardImageProgrammatic method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.empty);
    LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    view = new GestureImageView(this);
    view.setImageResource(R.drawable.image);
    view.setLayoutParams(params);
    ViewGroup layout = (ViewGroup) findViewById(R.id.layout);
    layout.addView(view);
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) GestureImageView(com.polites.android.GestureImageView) ViewGroup(android.view.ViewGroup)

Example 8 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project nmid-headline by miao1007.

the class EditPage method getAtLine.

// if platform selected form platform gridview is SinaWeibo,
// TencentWeibo, Facebook, or Twitter, there will be a button
// in the left-bottom of the page, which provides At-friends function
private LinearLayout getAtLine(String platform) {
    if (!isShowAtUserLayout(platform)) {
        return null;
    }
    LinearLayout llAt = new LinearLayout(getContext());
    LayoutParams lpAt = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lpAt.rightMargin = dipToPx(getContext(), 4);
    lpAt.gravity = Gravity.LEFT | Gravity.BOTTOM;
    lpAt.weight = 1;
    llAt.setLayoutParams(lpAt);
    llAt.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            FollowListPage subPage = new FollowListPage();
            subPage.setPlatform(platforms.get(0));
            subPage.showForResult(activity, null, EditPage.this);
        }
    });
    TextView tvAt = new TextView(getContext());
    int resId = getBitmapRes(activity, "btn_back_nor");
    if (resId > 0) {
        tvAt.setBackgroundResource(resId);
    }
    int dp_32 = dipToPx(getContext(), 32);
    tvAt.setLayoutParams(new LayoutParams(dp_32, dp_32));
    tvAt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    tvAt.setText(getAtUserButtonText(platform));
    int dp_2 = dipToPx(getContext(), 2);
    tvAt.setPadding(0, 0, 0, dp_2);
    tvAt.setTypeface(Typeface.DEFAULT_BOLD);
    tvAt.setTextColor(0xff000000);
    tvAt.setGravity(Gravity.CENTER);
    llAt.addView(tvAt);
    TextView tvName = new TextView(getContext());
    tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    tvName.setTextColor(0xff000000);
    resId = getStringRes(activity, "list_friends");
    String text = getContext().getString(resId, getName(platform));
    tvName.setText(text);
    LayoutParams lpName = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lpName.gravity = Gravity.CENTER_VERTICAL;
    tvName.setLayoutParams(lpName);
    llAt.addView(tvName);
    return llAt;
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) ImageView(android.widget.ImageView) HorizontalScrollView(android.widget.HorizontalScrollView) View(android.view.View) TextView(android.widget.TextView) BitmapHelper.captureView(com.mob.tools.utils.BitmapHelper.captureView) LinearLayout(android.widget.LinearLayout)

Example 9 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project nmid-headline by miao1007.

the class EditPage method getBodyBottom.

private LinearLayout getBodyBottom() {
    LinearLayout llBottom = new LinearLayout(getContext());
    llBottom.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    LinearLayout line = getAtLine(platforms.get(0).getName());
    if (line != null) {
        llBottom.addView(line);
    }
    // Words counter
    tvCounter = new TextView(getContext());
    tvCounter.setText(String.valueOf(MAX_TEXT_COUNT));
    tvCounter.setTextColor(0xffcfcfcf);
    tvCounter.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    tvCounter.setTypeface(Typeface.DEFAULT_BOLD);
    LayoutParams lpCounter = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lpCounter.gravity = Gravity.CENTER_VERTICAL;
    tvCounter.setLayoutParams(lpCounter);
    llBottom.addView(tvCounter);
    return llBottom;
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 10 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project MaterialDesignLibrary by navasmdc.

the class ColorSelector method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.color_selector);
    view = (LinearLayout) findViewById(R.id.contentSelector);
    backView = (RelativeLayout) findViewById(R.id.rootSelector);
    backView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getX() < view.getLeft() || event.getX() > view.getRight() || event.getY() > view.getBottom() || event.getY() < view.getTop()) {
                dismiss();
            }
            return false;
        }
    });
    colorView = findViewById(R.id.viewColor);
    colorView.setBackgroundColor(color);
    // Resize ColorView
    colorView.post(new Runnable() {

        @Override
        public void run() {
            LayoutParams params = (LayoutParams) colorView.getLayoutParams();
            params.height = colorView.getWidth();
            colorView.setLayoutParams(params);
        }
    });
    // Configure Sliders
    red = (Slider) findViewById(R.id.red);
    green = (Slider) findViewById(R.id.green);
    blue = (Slider) findViewById(R.id.blue);
    int r = (this.color >> 16) & 0xFF;
    int g = (this.color >> 8) & 0xFF;
    int b = (this.color >> 0) & 0xFF;
    red.setValue(r);
    green.setValue(g);
    blue.setValue(b);
    red.setOnValueChangedListener(this);
    green.setOnValueChangedListener(this);
    blue.setOnValueChangedListener(this);
}
Also used : OnTouchListener(android.view.View.OnTouchListener) LayoutParams(android.widget.LinearLayout.LayoutParams) View(android.view.View) MotionEvent(android.view.MotionEvent)

Aggregations

LayoutParams (android.widget.LinearLayout.LayoutParams)78 LinearLayout (android.widget.LinearLayout)44 View (android.view.View)36 TextView (android.widget.TextView)24 ImageView (android.widget.ImageView)17 Button (android.widget.Button)16 ProgressBar (android.widget.ProgressBar)9 Message (android.os.Message)8 OnClickListener (android.view.View.OnClickListener)8 ScrollView (android.widget.ScrollView)7 Handler (android.os.Handler)6 ViewGroup (android.view.ViewGroup)6 WebView (android.webkit.WebView)6 HorizontalScrollView (android.widget.HorizontalScrollView)5 ChangeBounds (android.transition.ChangeBounds)4 Crossfade (android.transition.Crossfade)4 Scene (android.transition.Scene)4 TransitionSet (android.transition.TransitionSet)4 SurfaceView (android.view.SurfaceView)4 TextureView (android.view.TextureView)4