微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.widget.LinearLayout.LayoutParams的实例源码

项目:ShangHanLun    文件ATableViewCellAccessoryView.java   
private static ImageView getAccessoryView(ATableViewCell cell,ATableViewCellAccessoryType accessoryType) {
    LinearLayout containerView = (LinearLayout) cell.findViewById(R.id.containerView);

    // check if accessoryView already exists for current cell before creating a new instance.
    ImageView accessoryView = (ImageView) containerView.findViewById(R.id.accessoryView);
    if (accessoryView == null) {
        Resources res = cell.getResources();

        // get marginRight for accessoryView,disclosureButton has a different one.
        LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.MATCH_PARENT);
        int marginRight = (int) res.getDimension(R.dimen.atv_cell_content_margin);
        if (accessoryType == ATableViewCellAccessoryType.disclosureButton) {
            marginRight = (int) res.getDimension(R.dimen.atv_cell_disclosure_button_margin_right);
        }
        params.setMargins(0,marginRight,0);

        // setup.
        accessoryView = new ATableViewCellAccessoryView(cell.getContext());
        accessoryView.setId(R.id.accessoryView);
        accessoryView.setLayoutParams(params);

        containerView.addView(accessoryView);
    }

    return accessoryView;
}
项目:boohee_v5.6    文件MQEmotionKeyboardLayout.java   
protected void processLogic() {
    this.mIndicatorIvList = new ArrayList();
    this.mGridViewList = new ArrayList();
    int emotionPageCount = ((MQEmotionUtil.sEmotionKeyArr.length - 1) / 27) + 1;
    LayoutParams indicatorIvLp = new LayoutParams(-2,-2);
    int margin = MQUtils.dip2px(getContext(),5.0f);
    indicatorIvLp.setMargins(margin,margin,margin);
    for (int i = 0; i < emotionPageCount; i++) {
        ImageView indicatorIv = new ImageView(getContext());
        indicatorIv.setLayoutParams(indicatorIvLp);
        indicatorIv.setimageResource(R.drawable.mq_selector_emotion_indicator);
        indicatorIv.setEnabled(false);
        this.mIndicatorIvList.add(indicatorIv);
        this.mIndicatorLl.addView(indicatorIv);
        this.mGridViewList.add(getGridView(i));
    }
    ((ImageView) this.mIndicatorIvList.get(0)).setEnabled(true);
    this.mContentVp.setAdapter(new EmotionPagerAdapter());
}
项目:apps_small    文件SimpleTabDeFinition.java   
@Override
public View createTabView(LayoutInflater inflater,ViewGroup tabsView) {
    // we need to inflate the view based on the layout id specified when
    // this instance was created.
    View indicator = inflater.inflate(
        _tabLayoutId,tabsView,false);

    // set up the title of the tab. this will populate the text with the
    // string defined by the resource passed in when this instance was
    // created. the text will also be centered within the title control.
       TextView titleView = (TextView)indicator.findViewById(_tabTitleViewId);
       titleView.setText(_tabTitleResourceId);
       titleView.setGravity(Gravity.CENTER);

       // ensure the control we're inflating is layed out properly. this will
       // cause our tab titles to be placed evenly weighted across the top.
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
        layoutParams.weight = 1;
       indicator.setLayoutParams(layoutParams);

       return indicator;
}
项目:MyFire    文件ResultActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_result);

    Bundle extras = getIntent().getExtras();

    mResultimage = (ImageView) findViewById(R.id.result_image);
    mResultText = (TextView) findViewById(R.id.result_text);

    if (null != extras) {
        int width = extras.getInt("width");
        int height = extras.getInt("height");

        LayoutParams lps = new LayoutParams(width,height);
        lps.topMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,30,getResources().getdisplayMetrics());
        lps.leftMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,20,getResources().getdisplayMetrics());
        lps.rightMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,getResources().getdisplayMetrics());

        mResultimage.setLayoutParams(lps);

        String result = extras.getString("result");
        mResultText.setText(result);

        Bitmap barcode = null;
        byte[] compressedBitmap = extras.getByteArray(DecodeThread.BARCODE_BITMAP);
        if (compressedBitmap != null) {
            barcode = BitmapFactory.decodeByteArray(compressedBitmap,compressedBitmap.length,null);
            // Mutable copy:
            barcode = barcode.copy(Bitmap.Config.RGB_565,true);
        }

        mResultimage.setimageBitmap(barcode);
    }
}
项目:ywApplication    文件EditPage.java   
private RelativeLayout getPageView() {
    rlPage = new RelativeLayout(getContext());
    rlPage.setBackgroundDrawable(background);
    if (dialogMode) {
        RelativeLayout rlDialog = new RelativeLayout(getContext());
        rlDialog.setBackgroundColor(0xc0323232);
        int dp_8 = dipToPx(getContext(),8);
        int width = getScreenWidth(getContext()) - dp_8 * 2;
        RelativeLayout.LayoutParams lpDialog = new RelativeLayout.LayoutParams(
                width,LayoutParams.WRAP_CONTENT);
        lpDialog.topMargin = dp_8;
        lpDialog.bottomMargin = dp_8;
        lpDialog.addRule(RelativeLayout.CENTER_IN_PARENT);
        rlDialog.setLayoutParams(lpDialog);
        rlPage.addView(rlDialog);

        rlDialog.addView(getPageTitle());
        rlDialog.addView(getPageBody());
        rlDialog.addView(getimagePin());
    } else {
        rlPage.addView(getPageTitle());
        rlPage.addView(getPageBody());
        rlPage.addView(getimagePin());
    }
    return rlPage;
}
项目:boohee_v5.6    文件PlatformGridView.java   
private void init(Context context) {
    calPageSize();
    setorientation(1);
    this.pager = new ViewPagerClassic(context);
    disableOverScrollMode(this.pager);
    this.pager.setLayoutParams(new LayoutParams(-1,-2));
    addView(this.pager);
    new Thread() {
        public void run() {
            try {
                PlatformGridView.this.platformlist = ShareSDK.getPlatformlist();
                if (PlatformGridView.this.platformlist == null) {
                    PlatformGridView.this.platformlist = new Platform[0];
                }
                UIHandler.sendEmptyMessage(1,PlatformGridView.this);
            } catch (Throwable t) {
                t.printstacktrace();
            }
        }
    }.start();
}
项目:Hotspot-master-devp    文件HotsDialog.java   
public HotsDialog builder() {
    view = LayoutInflater.from(context).inflate(R.layout.common_hotsdialog,null);

    lLayout_bg = (RelativeLayout) view.findViewById(R.id.layout_bg);
    txt_title = (TextView) view.findViewById(R.id.txt_title);
    txt_title.setVisibility(View.VISIBLE);
    txt_msg = (TextView) view.findViewById(R.id.txt_msg);
    txt_msg.setVisibility(View.VISIBLE);

    txt_point = (TextView) view.findViewById(R.id.txt_point);
    btn_neg = (Button) view.findViewById(R.id.btn_neg);
    btn_neg.setVisibility(View.VISIBLE);

    btn_mid = (Button) view.findViewById(R.id.btn_mid);
    btn_mid.setVisibility(View.VISIBLE);

    dialog = new Dialog(context,R.style.AlertDialogStyle);
    dialog.setContentView(view);

    lLayout_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (
            display.getWidth() * 0.85),LayoutParams.WRAP_CONTENT));

    return this;
}
项目:letv    文件MainBottomNavigationView.java   
public void setNavigations() {
    removeAllViews();
    int height = UIsUtils.dipToPx(49.0f);
    NavigationType[] types = NavigationType.values();
    int len = types.length;
    for (int i = 0; i < len; i++) {
        LayoutParams params = new LayoutParams(height,height);
        if (i == 0) {
            params.leftMargin = UIsUtils.dipToPx(14.0f);
        } else {
            params.leftMargin = ((UIsUtils.getScreenWidth() - (UIsUtils.dipToPx(14.0f) * 2)) - (len * height)) / (len - 1);
        }
        BottomNavigationItemView itemView = new BottomNavigationItemView(this,this.mContext);
        itemView.setData(types[i]);
        addView(itemView,params);
    }
    setSelectedType(NavigationType.HOME);
}
项目:letv    文件FeedBackActivity.java   
public void afterTextChanged(Editable s) {
    int length = calculateLength(s.toString());
    this.mFeedBackEditText.removeTextChangedListener(this);
    if (length > LeMessageIds.MSG_FLOAT_BALL_REQUEST_DATA) {
        this.mNumberTextView.setTextColor(getResources().getColor(2131493199));
    } else {
        this.mNumberTextView.setTextColor(getResources().getColor(2131493160));
    }
    this.mNumberTextView.setText(String.valueOf(length / 2));
    LayoutParams params = (LayoutParams) this.mFeedBackEditText.getLayoutParams();
    if (this.mHeight == -1) {
        this.mHeight = params.height;
    }
    if (this.mFeedBackEditText.getLineCount() > 5) {
        params.height = -2;
        this.mFeedBackEditText.setLayoutParams(params);
    } else {
        params.height = this.mHeight;
        this.mFeedBackEditText.setLayoutParams(params);
    }
    this.mFeedBackEditText.addTextChangedListener(this);
}
项目:letv    文件Registeractivity.java   
@SuppressLint({"NewApi"})
private void changeViewPageHight() {
    final int w = MeasureSpec.makeMeasureSpec(0,0);
    final int h = MeasureSpec.makeMeasureSpec(0,0);
    this.mRegisterViewPager.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener(this) {
        final /* synthetic */ Registeractivity this$0;

        public void onGlobalLayout() {
            if (VERSION.SDK_INT >= 16) {
                this.this$0.mRegisterViewPager.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            } else {
                this.this$0.mRegisterViewPager.getViewTreeObserver().removeGlobalOnLayoutListener(this);
            }
            View view = this.this$0.mRegisterViewPager.getChildAt(this.this$0.mRegisterViewPager.getCurrentItem());
            view.measure(w,h);
            LayoutParams params = new LayoutParams(-1,-2);
            params.height = view.getMeasuredHeight();
            this.this$0.mRegisterViewPager.setLayoutParams(params);
        }
    });
}
项目:letv    文件NewFeatureActivity.java   
public void updateUI() {
    this.recoAppName.setText(this.mrecoApp.getName());
    String[] split = this.mrecoApp.getDesc().split("/");
    if (split.length == 2) {
        this.reco_desp.setPadding(0,60);
    }
    for (CharSequence text : split) {
        TextView tv = new TextView(this);
        tv.setLayoutParams(new LayoutParams(-1,-1,1.0f));
        tv.setShadowLayer(3.0f,3.0f,1.0f,2131493090);
        tv.setTextColor(-1);
        tv.setGravity(1);
        tv.setText(text);
        tv.setTextSize(18.0f);
        this.reco_desp.addView(tv);
    }
}
项目:letv    文件MyMessageTabPageIndicator.java   
protected void addTab(int index,CharSequence text,int iconResId) {
    TabView tabView = new TabView(this,getContext(),text);
    tabView.setIndex(index);
    tabView.setTextSize(1,15.0f);
    tabView.setFocusable(true);
    tabView.setonClickListener(this.mTabClickListener);
    if (iconResId != 0) {
        tabView.setCompoundDrawablesWithIntrinsicBounds(iconResId,0);
    }
    int width = this.mMeanWidth == -1 ? tabView.getCustomWidth() : this.mMeanWidth;
    if (this.mMeanWidth != -1) {
        tabView.setSize(this.mMeanWidth,UIsUtils.dipToPx(43.0f));
    }
    tabView.setLayoutParams(new LayoutParams(width,tabView.getCustomHeight(),17.0f));
    LinearLayout linearLayout = new LinearLayout(this.mContext);
    linearLayout.setorientation(1);
    linearLayout.setGravity(17);
    linearLayout.setLayoutParams(new LayoutParams(width,-2,17.0f));
    linearLayout.addView(tabView);
    View imageView = new View(this.mContext);
    imageView.setLayoutParams(new LayoutParams(UIsUtils.dipToPx(76.0f),UIsUtils.dipToPx(2.0f),17.0f));
    imageView.setBackgroundColor(this.mContext.getResources().getColor(2131493202));
    linearLayout.addView(imageView);
    this.mTabLayout.addView(linearLayout);
}
项目:Huochexing12306    文件EditPage.java   
private RelativeLayout getPageView() {
    rlPage = new RelativeLayout(getContext());
    rlPage.setBackgroundDrawable(background);
    if (dialogMode) {
        RelativeLayout rlDialog = new RelativeLayout(getContext());
        rlDialog.setBackgroundColor(0xc0323232);
        int dp_8 = dipToPx(getContext(),LayoutParams.WRAP_CONTENT);
        lpDialog.topMargin = dp_8;
        lpDialog.bottomMargin = dp_8;
        lpDialog.addRule(RelativeLayout.CENTER_IN_PARENT);
        rlDialog.setLayoutParams(lpDialog);
        rlPage.addView(rlDialog);

        rlDialog.addView(getPageTitle());
        rlDialog.addView(getPageBody());
        rlDialog.addView(getimagePin());
    } else {
        rlPage.addView(getPageTitle());
        rlPage.addView(getPageBody());
        rlPage.addView(getimagePin());
    }
    return rlPage;
}
项目:Huochexing12306    文件EditPage.java   
private LinearLayout getBodyBottom() {
    LinearLayout llBottom = new LinearLayout(getContext());
    llBottom.setLayoutParams(new LinearLayout.LayoutParams(
            LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));

    String platform = String.valueOf(reqData.get("platform"));
    LinearLayout line = getAtLine(platform);
    if (line != null) {
        llBottom.addView(line);
    }

    // 字数统计
    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);
    LinearLayout.LayoutParams lpCounter = new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    lpCounter.gravity = Gravity.CENTER_VERTICAL;
    tvCounter.setLayoutParams(lpCounter);
    llBottom.addView(tvCounter);

    return llBottom;
}
项目:CC    文件LoginActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    callId = intent.getStringExtra("callId");
    LinearLayout layout = new LinearLayout(this);
    layout.setorientation(LinearLayout.VERTICAL);
    layout.setPadding(20,20);
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
    editText = new EditText(this);
    editText.setHint(R.string.demo_b_username_hint);
    editText.setText("billy");
    layout.addView(editText,params);
    Button button = new Button(this);
    button.setText(R.string.demo_b_click_login);
    button.setonClickListener(this);
    layout.addView(button,params);
    setContentView(layout);
}
项目:SmartMath    文件ActivityImeMultiEdtsOri.java   
protected void setFullScreenForSmallLandscape() {
    int nScreenSizeCategory = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
    int nScreenorientation = getResources().getConfiguration().orientation;
    if (nScreenorientation != Configuration.ORIENTATION_LANDSCAPE)  {
        if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL)   {        // making it full screen in portrait mode if small screen
            getwindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
        } else  {
            getwindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }
    } else  {
        if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL
                || nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_norMAL)   {        // making it full screen in landscape mode if small or normal screen
            getwindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
        } else  {
            getwindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }
    }

}
项目:UIWidget    文件UIActionSheetView.java   
/**
 * 设置标题
 *
 * @param title
 * @return
 */
public UIActionSheetView setTitle(CharSequence title) {
    showTitle = true;
    tvTitle.setVisibility(View.VISIBLE);
    tvTitle.setText(title);
    tvTitle.post(new Runnable() {
        @Override
        public void run() {
            if (tvTitle.getLineCount() > 1) {
                tvTitle.setGravity(Gravity.LEFT);
            } else if (tvTitle.getLineCount() > 2) {
                tvTitle.setGravity(Gravity.LEFT);
                tvTitle.setLayoutParams(new LayoutParams(
                        LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
            }
        }
    });
    return this;
}
项目:boohee_v5.6    文件IcslinearLayout.java   
protected void measureChildWithMargins(View child,int parentWidthMeasureSpec,int widthUsed,int parentHeightMeasureSpec,int heightUsed) {
    int index = indexOfChild(child);
    int orientation = getorientation();
    LayoutParams params = (LayoutParams) child.getLayoutParams();
    if (hasDividerBeforeChildAt(index)) {
        if (orientation == 1) {
            params.topMargin = this.mDividerHeight;
        } else {
            params.leftMargin = this.mDividerWidth;
        }
    }
    int count = getChildCount();
    if (index == count - 1 && hasDividerBeforeChildAt(count)) {
        if (orientation == 1) {
            params.bottomMargin = this.mDividerHeight;
        } else {
            params.rightMargin = this.mDividerWidth;
        }
    }
    super.measureChildWithMargins(child,parentWidthMeasureSpec,widthUsed,parentHeightMeasureSpec,heightUsed);
}
项目:boohee_v5.6    文件IcslinearLayout.java   
private void drawDividersvertical(Canvas canvas) {
    int count = getChildCount();
    int i = 0;
    while (i < count) {
        View child = getChildAt(i);
        if (!(child == null || child.getVisibility() == 8 || !hasDividerBeforeChildAt(i))) {
            drawHorizontalDivider(canvas,child.getTop() - ((LayoutParams) child
                    .getLayoutParams()).topMargin);
        }
        i++;
    }
    if (hasDividerBeforeChildAt(count)) {
        int bottom;
        child = getChildAt(count - 1);
        if (child == null) {
            bottom = (getHeight() - getPaddingBottom()) - this.mDividerHeight;
        } else {
            bottom = child.getBottom();
        }
        drawHorizontalDivider(canvas,bottom);
    }
}
项目:boohee_v5.6    文件IcslinearLayout.java   
private void drawDividersHorizontal(Canvas canvas) {
    int count = getChildCount();
    int i = 0;
    while (i < count) {
        View child = getChildAt(i);
        if (!(child == null || child.getVisibility() == 8 || !hasDividerBeforeChildAt(i))) {
            drawVerticalDivider(canvas,child.getLeft() - ((LayoutParams) child
                    .getLayoutParams()).leftMargin);
        }
        i++;
    }
    if (hasDividerBeforeChildAt(count)) {
        int right;
        child = getChildAt(count - 1);
        if (child == null) {
            right = (getWidth() - getPaddingRight()) - this.mDividerWidth;
        } else {
            right = child.getRight();
        }
        drawVerticalDivider(canvas,right);
    }
}
项目:boohee_v5.6    文件BooheeTabLayout.java   
public void setupChild(List<TabModelInterface> list) {
    if (list != null && list.size() != 0) {
        this.mTabList.clear();
        this.mTabList.addAll(list);
        this.tabStrip.removeAllViews();
        for (TabModelInterface model : list) {
            TextView textView = new TextView(getContext());
            textView.setGravity(17);
            textView.setText(model.getTabName());
            textView.setTextColor(getResources().getColor(R.color.du));
            textView.setTextSize(0,this.textSize);
            LayoutParams params = new LayoutParams(-2,-1);
            textView.setPadding(ViewUtils.dip2px(getContext(),16.0f),ViewUtils.dip2px
                    (getContext(),0);
            textView.setonClickListener(new InternalTabClickListener());
            this.tabStrip.addView(textView,params);
            textView.measure(MeasureSpec.makeMeasureSpec(0,0),MeasureSpec.makeMeasureSpec
                    (0,0));
        }
        initView();
    }
}
项目:boohee_v5.6    文件CircleWeight.java   
private void initView() {
    LayoutParams paramsWeight = new LayoutParams(-1,0);
    paramsWeight.weight = IPhotoView.DEFAULT_MAX_SCALE;
    this.tvWeight = new TextView(getContext());
    this.tvWeight.setLayoutParams(paramsWeight);
    this.tvWeight.setGravity(81);
    this.tvWeight.setText("65");
    this.tvWeight.setTextColor(this.VIEW_COLOR);
    this.tvWeight.setTextSize(2,22.0f);
    LayoutParams paramsUnit = new LayoutParams(-1,0);
    paramsUnit.weight = 2.0f;
    this.tvUnit = new TextView(getContext());
    this.tvUnit.setLayoutParams(paramsUnit);
    this.tvUnit.setGravity(49);
    this.tvUnit.setPadding(0,this.munitPaddingTop,0);
    this.tvUnit.setText("kg");
    this.tvUnit.setTextSize(2,16.0f);
    this.tvUnit.setTextColor(this.VIEW_COLOR);
    addView(this.tvWeight);
    addView(this.tvUnit);
}
项目:boohee_v5.6    文件SportProgress.java   
private void resetLayout() {
    this.mIndicateWidth = getHeight() / 2;
    int space = (getWidth() - this.mIndicateWidth) / this.mMax;
    FrameLayout.LayoutParams paramsProgress = (FrameLayout.LayoutParams) this.view_progress
            .getLayoutParams();
    paramsProgress.width = this.mProgress * space;
    this.view_progress.setLayoutParams(paramsProgress);
    FrameLayout.LayoutParams indicateProgress = (FrameLayout.LayoutParams) this.view_indicate
            .getLayoutParams();
    if (this.mProgress == 0) {
        indicateProgress.leftMargin = 0;
    } else {
        indicateProgress.leftMargin = (this.mProgress * space) - this.mIndicateWidth;
    }
    this.view_indicate.setLayoutParams(indicateProgress);
}
项目:GitHub    文件GridPickerView.java   
/**添加tab
 * @param tabPosition
 * @param tabWidth
 * @param name
 */
@SuppressLint("NewApi")
private void addTab(final int tabPosition,int tabWidth,String name) {
    if (StringUtil.isNotEmpty(name,true) == false) {
        return;
    }
    name = StringUtil.getTrimedString(name);

    final TextView tvTab = new TextView(context);
    tvTab.setLayoutParams(new LayoutParams(tabWidth,LayoutParams.MATCH_PARENT));
    tvTab.setGravity(Gravity.CENTER);
    //      tvTab.setPaddingrelative(4,12,4,12);
    tvTab.setTextColor(context.getResources().getColor(R.color.black));
    tvTab.setBackgroundResource(R.drawable.to_alpha);
    tvTab.setTextSize(18);
    tvTab.setSingleLine(true);
    tvTab.setText(name);
    tvTab.setonClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (tabPosition == getCurrentTabPosition()) {
                return;
            }

            if (onTabClickListener != null) {
                onTabClickListener.onTabClick(tabPosition,tvTab);
                return;
            }
            //点击就是要切换list,这些配置都要改bindView(tabSuffix,tabPosition,tabName,list,numColumns,maxShowRows,itemPosition)
        }
    });
    llGridPickerViewTabContainer.addView(tvTab);
}
项目:GitHub    文件CustomPopupWindow.java   
private void initLayout() {
    mListener.initPopupView(mContentView);
    setWidth(isWrap ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT);
    setHeight(isWrap ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT);
    setFocusable(isFocus);
    setoutsidetouchable(isOutsidetouch);
    setBackgroundDrawable(mBackgroundDrawable);
    if (mAnimationStyle != -1)//如果设置了对话则使用对话
        setAnimationStyle(mAnimationStyle);
    setContentView(mContentView);
}
项目:GitHub    文件PopuWindowView.java   
public PopuWindowView(Context mContext,int widthGravity) {
    this.mContext = mContext;
    LayoutInflater inflater = LayoutInflater.from(mContext);
    viewItem = inflater.inflate(R.layout.dialogui_popu_options,null);
    pupoListView = (ListView) viewItem.findViewById(R.id.customui_list);
    mPopuWindowAdapter = new PopuWindowAdapter(mContext,popuLists);
    pupoListView.setAdapter(mPopuWindowAdapter);
    pullDownView = new PopupWindow(viewItem,widthGravity,LayoutParams.WRAP_CONTENT,true);
    pullDownView.setoutsidetouchable(true);
    pullDownView.setBackgroundDrawable(new BitmapDrawable());
    pupoListView.setonItemClickListener(this);
}
项目:yyox    文件CustomPopupWindow.java   
private void initLayout() {
    mListener.initPopupView(mContentView);
    setWidth(isWrap ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT);
    setHeight(isWrap ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT);
    setFocusable(isFocus);
    setoutsidetouchable(isOutsidetouch);
    setBackgroundDrawable(mBackgroundDrawable);
    if (mAnimationStyle != -1)//如果设置了对话则使用对话
        setAnimationStyle(mAnimationStyle);
    setContentView(mContentView);
}
项目:PeSanKita-android    文件ViewUtil.java   
public static float getX(final @NonNull View v) {
  if (VERSION.SDK_INT >= 11) {
    return ViewCompat.getX(v);
  } else {
    return ((LayoutParams)v.getLayoutParams()).leftMargin;
  }
}
项目:boohee_v5.6    文件TabLayout.java   
protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec,heightMeasureSpec);
    if (MeasureSpec.getMode(widthMeasureSpec) == 1073741824 && TabLayout.this.mMode == 1 && TabLayout.this.mTabGravity == 1) {
        int i;
        int count = getChildCount();
        int largestTabWidth = 0;
        int z = count;
        for (i = 0; i < z; i++) {
            View child = getChildAt(i);
            if (child.getVisibility() == 0) {
                largestTabWidth = Math.max(largestTabWidth,child.getMeasuredWidth());
            }
        }
        if (largestTabWidth > 0) {
            boolean remeasure = false;
            if (largestTabWidth * count <= getMeasuredWidth() - (TabLayout.this.dpToPx(16) * 2)) {
                for (i = 0; i < count; i++) {
                    LayoutParams lp = (LayoutParams) getChildAt(i).getLayoutParams();
                    if (lp.width != largestTabWidth || lp.weight != 0.0f) {
                        lp.width = largestTabWidth;
                        lp.weight = 0.0f;
                        remeasure = true;
                    }
                }
            } else {
                TabLayout.this.mTabGravity = 0;
                TabLayout.this.updateTabViews(false);
                remeasure = true;
            }
            if (remeasure) {
                super.onMeasure(widthMeasureSpec,heightMeasureSpec);
            }
        }
    }
}
项目:aarLibrary    文件XRefreshContentView.java   
public void setContentViewLayoutParams(boolean isHeightMatchParent,boolean isWidthMatchParent) {
    LayoutParams lp = (LayoutParams) child.getLayoutParams();
    if (isHeightMatchParent) {
        lp.height = LayoutParams.MATCH_PARENT;
    }
    if (isWidthMatchParent) {
        lp.height = LayoutParams.MATCH_PARENT;
    }
    // 认设置宽高为match_parent
    child.setLayoutParams(lp);
}
项目:boohee_v5.6    文件d.java   
public void onProgressChanged(WebView webView,int i) {
    super.onProgressChanged(webView,i);
    LayoutParams layoutParams = (LayoutParams) this.b.d.getLayoutParams();
    layoutParams.width = (this.a * i) / 100;
    this.b.d.setLayoutParams(layoutParams);
    if (i <= 0 || i >= 100) {
        this.b.d.setVisibility(8);
    } else {
        this.b.d.setVisibility(0);
    }
}
项目:ywApplication    文件EditPage.java   
private TitleLayout getPageTitle() {
        llTitle = new TitleLayout(getContext());
        llTitle.setId(1);
//      int resId = getBitmapRes(activity,"title_back");
//      if (resId > 0) {
//          llTitle.setBackgroundResource(resId);
//      }
        llTitle.getBtnBack().setonClickListener(this);
        int resId = getStringRes(activity,"multi_share");
        if (resId > 0) {
            llTitle.getTvTitle().setText(resId);
        }
        llTitle.getBtnRight().setVisibility(View.VISIBLE);
        resId = getStringRes(activity,"share");
        if (resId > 0) {
            llTitle.getBtnRight().setText(resId);
        }
        llTitle.getBtnRight().setonClickListener(this);
        RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
                LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
        lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        lp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        llTitle.setLayoutParams(lp);

        return llTitle;
    }
项目:LeCatApp    文件MyAlertDialog.java   
public MyAlertDialog builder() {
    // 获取Dialog布局
    View view = LayoutInflater.from(context).inflate(
            R.layout.view_alertdialog,null);

    // 获取自定义Dialog布局中的控件
    lLayout_bg = (LinearLayout) view.findViewById(R.id.lLayout_bg);
    txt_title = (TextView) view.findViewById(R.id.txt_title);
    txt_title.setVisibility(View.GONE);
    txt_msg = (TextView) view.findViewById(R.id.txt_msg);
    txt_msg.setVisibility(View.GONE);
    btn_neg = (Button) view.findViewById(R.id.btn_neg);
    btn_neg.setVisibility(View.GONE);
    btn_pos = (Button) view.findViewById(R.id.btn_pos);
    btn_pos.setVisibility(View.GONE);
    img_line = (ImageView) view.findViewById(R.id.img_line);
    img_line.setVisibility(View.GONE);

    // 定义Dialog布局和参数
    dialog = new Dialog(context,R.style.AlertDialogStyle);
    dialog.setContentView(view);
    dialog.setCancelable(false);
    // 调整dialog背景大小
    lLayout_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (display
            .getWidth() * 0.85),LayoutParams.WRAP_CONTENT));

    return this;
}
项目:ywApplication    文件EditPage.java   
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;
}
项目:ywApplication    文件EditPage.java   
private LinearLayout getPlatformlist() {
    LinearLayout llToolBar = new LinearLayout(getContext());
    LayoutParams lpTb = new LayoutParams(
            LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
    llToolBar.setLayoutParams(lpTb);

    TextView tvShareto = new TextView(getContext());
    int resId = getStringRes(activity,"share_to");
    if (resId > 0) {
        tvShareto.setText(resId);
    }
    tvShareto.setTextColor(0xffcfcfcf);
    tvShareto.setTextSize(TypedValue.COMPLEX_UNIT_DIP,18);
    int dp_9 = dipToPx(getContext(),9);
    LayoutParams lpShareto = new LayoutParams(
            LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    lpShareto.gravity = Gravity.CENTER_VERTICAL;
    lpShareto.setMargins(dp_9,0);
    tvShareto.setLayoutParams(lpShareto);
    llToolBar.addView(tvShareto);

    horizontalscrollview sv = new horizontalscrollview(getContext());
    sv.setHorizontalScrollBarEnabled(false);
    sv.setHorizontalFadingEdgeEnabled(false);
    LayoutParams lpSv = new LayoutParams(
            LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    lpSv.setMargins(dp_9,dp_9,dp_9);
    sv.setLayoutParams(lpSv);
    llToolBar.addView(sv);

    llPlat = new LinearLayout(getContext());
    llPlat.setLayoutParams(new horizontalscrollview.LayoutParams(
            LayoutParams.WRAP_CONTENT,LayoutParams.MATCH_PARENT));
    sv.addView(llPlat);

    return llToolBar;
}
项目:boohee_v5.6    文件SportKeyboard.java   
private void findViews() {
    View view = LayoutInflater.from(getContext()).inflate(R.layout.view_sport_keyboard,null);
    this.btn1 = (Button) view.findViewById(R.id.btn1);
    this.btn2 = (Button) view.findViewById(R.id.btn2);
    this.btn3 = (Button) view.findViewById(R.id.btn3);
    this.btn4 = (Button) view.findViewById(R.id.btn4);
    this.btn5 = (Button) view.findViewById(R.id.btn5);
    this.btn6 = (Button) view.findViewById(R.id.btn6);
    this.btn7 = (Button) view.findViewById(R.id.btn7);
    this.btn8 = (Button) view.findViewById(R.id.btn8);
    this.btn9 = (Button) view.findViewById(R.id.btn9);
    this.btn0 = (Button) view.findViewById(R.id.btn0);
    this.btn_dot = (Button) view.findViewById(R.id.btn_dot);
    this.btn_back = (Button) view.findViewById(R.id.btn_back);
    NumBtnListener numBtnListener = new NumBtnListener();
    this.btn1.setonClickListener(numBtnListener);
    this.btn2.setonClickListener(numBtnListener);
    this.btn3.setonClickListener(numBtnListener);
    this.btn4.setonClickListener(numBtnListener);
    this.btn5.setonClickListener(numBtnListener);
    this.btn6.setonClickListener(numBtnListener);
    this.btn7.setonClickListener(numBtnListener);
    this.btn8.setonClickListener(numBtnListener);
    this.btn9.setonClickListener(numBtnListener);
    this.btn0.setonClickListener(numBtnListener);
    this.btn_back.setonClickListener(numBtnListener);
    this.txt_calory = (TextView) view.findViewById(R.id.txt_calory);
    this.txt_value = (TextView) view.findViewById(R.id.txt_value);
    this.txt_unit = (TextView) view.findViewById(R.id.txt_unit);
    this.txt_gram = (TextView) view.findViewById(R.id.txt_gram);
    this.txt_gram.setVisibility(8);
    addView(view,new LayoutParams(-1,-2));
}
项目:microMathematics    文件simpledialog.java   
public void disableButton(int id)
{
    View button = findViewById(id);
    final View other = findViewById(id == R.id.dialog_button_ok ? R.id.dialog_button_cancel : R.id.dialog_button_ok);
    if (button != null && other != null)
    {
        button.setVisibility(View.GONE);
        LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
        lp.setMargins(0,getContext().getResources().getDimensionPixelSize(R.dimen.dialog_buttons_margin));
        other.setLayoutParams(lp);
        findViewById(R.id.dialog_button_devider).setVisibility(View.GONE);
    }
}
项目:mvparms    文件CustomPopupWindow.java   
private void initLayout() {
    mListener.initPopupView(mContentView);
    setWidth(isWrap ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT);
    setHeight(isWrap ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT);
    setFocusable(isFocus);
    setoutsidetouchable(isOutsidetouch);
    setBackgroundDrawable(mBackgroundDrawable);
    if (mAnimationStyle != -1)//如果设置了对话则使用对话
        setAnimationStyle(mAnimationStyle);
    setContentView(mContentView);
}
项目:CSipSimple    文件WarningFragment.java   
private void bindView() {
    if(viewContainer != null) {
        viewContainer.removeAllViews();
        for(String warn : warnList) {
            Log.d(THIS_FILE,"Add " + warn + " warning");
            WarningBlockView v = WarningUtils.getViewForWarning(getActivity(),warn);
            if(v != null) {
                v.setonWarnChangedListener(this);
                v.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
                viewContainer.addView(v);
            }
        }
    }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。