Search in sources :

Example 46 with LayoutParams

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

the class EditPage method getMainBody.

private LinearLayout getMainBody() {
    LinearLayout llMainBody = new LinearLayout(getContext());
    llMainBody.setOrientation(LinearLayout.VERTICAL);
    LayoutParams lpMain = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    lpMain.weight = 1;
    int dp_4 = dipToPx(getContext(), 4);
    lpMain.setMargins(dp_4, dp_4, dp_4, dp_4);
    llMainBody.setLayoutParams(lpMain);
    LinearLayout llContent = new LinearLayout(getContext());
    LayoutParams lpContent = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    lpContent.weight = 1;
    llMainBody.addView(llContent, lpContent);
    // share content editor
    etContent = new EditText(getContext());
    etContent.setGravity(Gravity.LEFT | Gravity.TOP);
    etContent.setBackgroundDrawable(null);
    etContent.setText(String.valueOf(shareParamMap.get("text")));
    etContent.addTextChangedListener(this);
    LayoutParams lpEt = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lpEt.weight = 1;
    etContent.setLayoutParams(lpEt);
    llContent.addView(etContent);
    llContent.addView(getThumbView());
    llMainBody.addView(getBodyBottom());
    return llMainBody;
}
Also used : EditText(android.widget.EditText) LayoutParams(android.widget.LinearLayout.LayoutParams) LinearLayout(android.widget.LinearLayout)

Example 47 with LayoutParams

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

the class EditPage method getSep.

private View getSep() {
    View vSep = new View(getContext());
    vSep.setBackgroundColor(0xff000000);
    int dp_1 = dipToPx(getContext(), 1);
    LayoutParams lpSep = new LayoutParams(LayoutParams.MATCH_PARENT, dp_1);
    vSep.setLayoutParams(lpSep);
    return vSep;
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) ImageView(android.widget.ImageView) HorizontalScrollView(android.widget.HorizontalScrollView) View(android.view.View) TextView(android.widget.TextView) BitmapHelper.captureView(com.mob.tools.utils.BitmapHelper.captureView)

Example 48 with LayoutParams

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

the class EditPage method getThumbView.

// shared image container
private RelativeLayout getThumbView() {
    rlThumb = new RelativeLayout(getContext());
    rlThumb.setId(1);
    int dp_82 = dipToPx(getContext(), 82);
    int dp_98 = dipToPx(getContext(), 98);
    LayoutParams lpThumb = new LayoutParams(dp_82, dp_98);
    rlThumb.setLayoutParams(lpThumb);
    ivImage = new ImageView(getContext());
    int resId = getBitmapRes(activity, "btn_back_nor");
    if (resId > 0) {
        ivImage.setBackgroundResource(resId);
    }
    ivImage.setScaleType(ScaleType.CENTER_INSIDE);
    ivImage.setImageBitmap(image);
    int dp_4 = dipToPx(getContext(), 4);
    ivImage.setPadding(dp_4, dp_4, dp_4, dp_4);
    int dp_74 = dipToPx(getContext(), 74);
    RelativeLayout.LayoutParams lpImage = new RelativeLayout.LayoutParams(dp_74, dp_74);
    int dp_16 = dipToPx(getContext(), 16);
    int dp_8 = dipToPx(getContext(), 8);
    lpImage.setMargins(0, dp_16, dp_8, 0);
    ivImage.setLayoutParams(lpImage);
    ivImage.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            if (image != null && !image.isRecycled()) {
                PicViewer pv = new PicViewer();
                pv.setImageBitmap(image);
                pv.show(activity, null);
            }
        }
    });
    rlThumb.addView(ivImage);
    int dp_24 = dipToPx(getContext(), 24);
    progressBar = new ProgressBar(getContext());
    progressBar.setPadding(dp_24, dp_24, dp_24, dp_24);
    RelativeLayout.LayoutParams pb = new RelativeLayout.LayoutParams(dp_74, dp_74);
    pb.setMargins(0, dp_16, dp_8, 0);
    progressBar.setLayoutParams(pb);
    rlThumb.addView(progressBar);
    Button btn = new Button(getContext());
    btn.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            // remove the photo to share
            rlThumb.setVisibility(View.GONE);
            ivPin.setVisibility(View.GONE);
            removeImage(imgInfo);
        }
    });
    resId = getBitmapRes(activity, "img_cancel");
    if (resId > 0) {
        btn.setBackgroundResource(resId);
    }
    int dp_20 = dipToPx(getContext(), 20);
    RelativeLayout.LayoutParams lpBtn = new RelativeLayout.LayoutParams(dp_20, dp_20);
    lpBtn.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    lpBtn.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    btn.setLayoutParams(lpBtn);
    rlThumb.addView(btn);
    if (!haveImage()) {
        rlThumb.setVisibility(View.GONE);
    }
    return rlThumb;
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) PicViewer(cn.sharesdk.onekeyshare.PicViewer) Button(android.widget.Button) RelativeLayout(android.widget.RelativeLayout) OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) HorizontalScrollView(android.widget.HorizontalScrollView) View(android.view.View) TextView(android.widget.TextView) BitmapHelper.captureView(com.mob.tools.utils.BitmapHelper.captureView) ProgressBar(android.widget.ProgressBar)

Example 49 with LayoutParams

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

the class EditPage method afterPlatformListGot.

/** display platform list */
public void afterPlatformListGot() {
    int size = platformList == null ? 0 : platformList.length;
    views = new View[size];
    final int dp_24 = dipToPx(getContext(), 24);
    LayoutParams lpItem = new LayoutParams(dp_24, dp_24);
    final int dp_9 = dipToPx(getContext(), 9);
    lpItem.setMargins(0, 0, dp_9, 0);
    FrameLayout.LayoutParams lpMask = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    lpMask.gravity = Gravity.LEFT | Gravity.TOP;
    int selection = 0;
    for (int i = 0; i < size; i++) {
        FrameLayout fl = new FrameLayout(getContext());
        fl.setLayoutParams(lpItem);
        if (i >= size - 1) {
            fl.setLayoutParams(new LayoutParams(dp_24, dp_24));
        }
        llPlat.addView(fl);
        fl.setOnClickListener(this);
        ImageView iv = new ImageView(getContext());
        iv.setScaleType(ScaleType.CENTER_INSIDE);
        iv.setImageBitmap(getPlatLogo(platformList[i]));
        iv.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        fl.addView(iv);
        views[i] = new View(getContext());
        views[i].setBackgroundColor(0xcfffffff);
        views[i].setOnClickListener(this);
        String platformName = platformList[i].getName();
        for (Platform plat : platforms) {
            if (platformName.equals(plat.getName())) {
                views[i].setVisibility(View.INVISIBLE);
                selection = i;
            }
        }
        views[i].setLayoutParams(lpMask);
        fl.addView(views[i]);
    }
    final int postSel = selection;
    UIHandler.sendEmptyMessageDelayed(0, 333, new Callback() {

        public boolean handleMessage(Message msg) {
            HorizontalScrollView hsv = (HorizontalScrollView) llPlat.getParent();
            hsv.scrollTo(postSel * (dp_24 + dp_9), 0);
            return false;
        }
    });
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) Callback(android.os.Handler.Callback) Platform(cn.sharesdk.framework.Platform) CustomPlatform(cn.sharesdk.framework.CustomPlatform) Message(android.os.Message) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) HorizontalScrollView(android.widget.HorizontalScrollView) View(android.view.View) TextView(android.widget.TextView) BitmapHelper.captureView(com.mob.tools.utils.BitmapHelper.captureView) HorizontalScrollView(android.widget.HorizontalScrollView)

Example 50 with LayoutParams

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

the class DoubleImage method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.double_image);
    LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    view = new GestureImageView(this);
    view.setLayoutParams(params);
    ViewGroup layout = (ViewGroup) findViewById(R.id.layout);
    layout.addView(view);
    handler.sendEmptyMessageDelayed(IMAGE_LOAD, 2000);
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) GestureImageView(com.polites.android.GestureImageView) ViewGroup(android.view.ViewGroup)

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