當前位置: 首頁>>代碼示例>>Java>>正文


Java LayoutParams類代碼示例

本文整理匯總了Java中android.widget.LinearLayout.LayoutParams的典型用法代碼示例。如果您正苦於以下問題:Java LayoutParams類的具體用法?Java LayoutParams怎麽用?Java LayoutParams使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LayoutParams類屬於android.widget.LinearLayout包,在下文中一共展示了LayoutParams類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAccessoryView

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
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, 0, marginRight, 0);

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

        containerView.addView(accessoryView);
    }

    return accessoryView;
}
 
開發者ID:hh-in-zhuzhou,項目名稱:ShangHanLun,代碼行數:27,代碼來源:ATableViewCellAccessoryView.java

示例2: processLogic

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
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, 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());
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:20,代碼來源:MQEmotionKeyboardLayout.java

示例3: createTabView

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
@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;
}
 
開發者ID:alaskalinuxuser,項目名稱:apps_small,代碼行數:27,代碼來源:SimpleTabDefinition.java

示例4: onCreate

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
@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, 20, 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, 0, compressedBitmap.length, null);
			// Mutable copy:
			barcode = barcode.copy(Bitmap.Config.RGB_565, true);
		}

		mResultImage.setImageBitmap(barcode);
	}
}
 
開發者ID:wp521,項目名稱:MyFire,代碼行數:36,代碼來源:ResultActivity.java

示例5: getPageView

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
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;
}
 
開發者ID:liupengandroid,項目名稱:ywApplication,代碼行數:27,代碼來源:EditPage.java

示例6: init

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
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();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:22,代碼來源:PlatformGridView.java

示例7: builder

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
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;
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:25,代碼來源:HotsDialog.java

示例8: setNavigations

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
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);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:19,代碼來源:MainBottomNavigationView.java

示例9: afterTextChanged

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
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);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:23,代碼來源:FeedBackActivity.java

示例10: changeViewPageHight

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
@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);
        }
    });
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:22,代碼來源:RegisterActivity.java

示例11: updateUI

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
public void updateUI() {
    this.recoAppName.setText(this.mrecoApp.getName());
    String[] split = this.mrecoApp.getDesc().split("/");
    if (split.length == 2) {
        this.reco_desp.setPadding(0, 0, 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);
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:18,代碼來源:NewFeatureActivity.java

示例12: addTab

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
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, 0, 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);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:26,代碼來源:MyMessageTabPageIndicator.java

示例13: getBodyBottom

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
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;
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:26,代碼來源:EditPage.java

示例14: onCreate

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
@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, 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);
}
 
開發者ID:luckybilly,項目名稱:CC,代碼行數:20,代碼來源:LoginActivity.java

示例15: setFullScreenForSmallLandscape

import android.widget.LinearLayout.LayoutParams; //導入依賴的package包/類
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);
		}
	}
	
}
 
開發者ID:woshiwpa,項目名稱:SmartMath,代碼行數:22,代碼來源:ActivityImeMultiEdtsOri.java


注:本文中的android.widget.LinearLayout.LayoutParams類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。