当前位置: 首页>>代码示例>>Java>>正文


Java RelativeLayout.setBackgroundColor方法代码示例

本文整理汇总了Java中android.widget.RelativeLayout.setBackgroundColor方法的典型用法代码示例。如果您正苦于以下问题:Java RelativeLayout.setBackgroundColor方法的具体用法?Java RelativeLayout.setBackgroundColor怎么用?Java RelativeLayout.setBackgroundColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.RelativeLayout的用法示例。


在下文中一共展示了RelativeLayout.setBackgroundColor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateDialog

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    Bundle bundle = getArguments();
    this.layoutId = bundle.getInt(LAYOUT_KEY);
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View v = inflater.inflate(layoutId, null);
    RelativeLayout title = (RelativeLayout) v.findViewById(R.id.titleDialog);
    if (bundle.containsKey(COLOR_KEY)) {
        this.backgroundTitleColor = bundle.getInt(COLOR_KEY);
        title.setBackgroundColor(backgroundTitleColor);
    }


    //    View title = inflater.inflate(R.layout.dialog_openinghours_title,null);
    builder.setView(v);
    builder.setPositiveButton(R.string.dialog_ok_button, null);
    //    builder.setCustomTitle(title);
    builder.setIcon(R.drawable.clock);
    //  builder.setMessage(R.string.dialog_mensaje);


    return builder.create();
}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:26,代码来源:DialogOpeningHoursPharmacy.java

示例2: initView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void initView(Context context, AttributeSet attrs) {

        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.FunGameHeader);

        if (ta.hasValue(R.styleable.FunGameHeader_fgvMaskTopText)) {
            topMaskViewText = ta.getString(R.styleable.FunGameHeader_fgvMaskTopText);
        }
        if (ta.hasValue(R.styleable.FunGameHeader_fgvMaskBottomText)) {
            bottomMaskViewText = ta.getString(R.styleable.FunGameHeader_fgvMaskBottomText);
        }

        topMaskTextSize = ta.getDimensionPixelSize(R.styleable.FunGameHeader_fgvBottomTextSize, topMaskTextSize);
        bottomMaskTextSize = ta.getDimensionPixelSize(R.styleable.FunGameHeader_fgvBottomTextSize, bottomMaskTextSize);

        ta.recycle();

        curtainReLayout = new RelativeLayout(context);
        maskReLayout = new RelativeLayout(context);
        maskReLayout.setBackgroundColor(Color.parseColor("#3A3A3A"));

        topMaskView = createMaskTextView(context,topMaskViewText, topMaskTextSize, Gravity.BOTTOM);
        bottomMaskView = createMaskTextView(context,bottomMaskViewText, bottomMaskTextSize, Gravity.TOP);

        DIVIDING_LINE_SIZE = Math.max(1, DensityUtil.dp2px(0.5f));
    }
 
开发者ID:Brave-wan,项目名称:SmartRefresh,代码行数:26,代码来源:FunGameHeader.java

示例3: instantiateItem

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {

    // Create some layout params
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT,
            RelativeLayout.LayoutParams.WRAP_CONTENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);

    // Create some text
    TextView textView = getTextView(container.getContext());
    textView.setText(String.valueOf(position));
    textView.setLayoutParams(layoutParams);

    RelativeLayout layout = new RelativeLayout(container.getContext());
    layout.setBackgroundColor(ContextCompat.getColor(container.getContext(), R.color.colorPrimary));
    layout.setLayoutParams(layoutParams);

    layout.addView(textView);
    container.addView(layout);
    return layout;
}
 
开发者ID:PSD-Company,项目名称:duo-navigation-drawer,代码行数:23,代码来源:MainFragment.java

示例4: bindView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
    public void bindView(View view, Context context, Cursor cursor){
        String name = cursor.getString(cursor.getColumnIndex(ActivityDiaryContract.DiaryActivity.NAME));
        int color = cursor.getInt(cursor.getColumnIndex(ActivityDiaryContract.DiaryActivity.COLOR));
        int textColor = 0;

        TextView actName = (TextView) view.findViewById(R.id.activity_name);
        actName.setText(name);
        RelativeLayout bgrd = (RelativeLayout) view.findViewById(R.id.activity_background);
        bgrd.setBackgroundColor(color);
        actName.setTextColor(GraphicsHelper.textColorOnBackground(color));

        ImageView imageView = (ImageView) view.findViewById(R.id.activity_image);
/* TODO #33 fill image here */
    }
 
开发者ID:ramack,项目名称:ActivityDiary,代码行数:16,代码来源:ManageActivity.java

示例5: onCreate

import android.widget.RelativeLayout; //导入方法依赖的package包/类
public void onCreate() {
	super.onCreate();

	int screenHeight = ResHelper.getScreenHeight(activity);
	float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT;

	maxBodyHeight = 0;

	llPage = new LinearLayout(activity);
	llPage.setOrientation(LinearLayout.VERTICAL);
	activity.setContentView(llPage);

	rlTitle = new RelativeLayout(activity);
	rlTitle.setBackgroundColor(0xffe6e9ec);
	int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio);

	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight);
	llPage.addView(rlTitle, lp);
	initTitle(rlTitle, ratio);

	RelativeLayout rlBody = new RelativeLayout(activity);
	rlBody.setBackgroundColor(0xffffffff);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(rlBody, lp);
	initBody(rlBody, ratio);

	LinearLayout llShadow = new LinearLayout(activity);
	llShadow.setOrientation(LinearLayout.VERTICAL);
	rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	initShadow(llShadow, ratio);

	llBottom = new LinearLayout(activity);
	llBottom.setOrientation(LinearLayout.VERTICAL);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(llBottom, lp);
	initBottom(llBottom, ratio);
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:38,代码来源:EditPagePort.java

示例6: initBody

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void initBody(RelativeLayout rlBody, float ratio) {
	svContent = new ScrollView(activity);
	rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

	LinearLayout llContent = new LinearLayout(activity);
	llContent.setOrientation(LinearLayout.HORIZONTAL);
	svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

	etContent = new EditText(activity);
	int padding = (int) (DESIGN_LEFT_PADDING * ratio);
	etContent.setPadding(padding, padding, padding, padding);
	etContent.setBackgroundDrawable(null);
	etContent.setTextColor(0xff3b3b3b);
	etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
	etContent.setText(sp.getText());
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT);
	lp.weight = 1;
	llContent.addView(etContent, lp);
	etContent.addTextChangedListener(this);

	rlThumb = new RelativeLayout(activity);
	rlThumb.setBackgroundColor(0xff313131);
	int	thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio);
	int	xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio);
	lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth);
	lp.rightMargin = lp.bottomMargin = lp.topMargin = padding;
	llContent.addView(rlThumb, lp);

	aivThumb = new AsyncImageView(activity) {
		public void onImageGot(String url, Bitmap bm) {
			thumb = bm;
			super.onImageGot(url, bm);
		}
	};
	aivThumb.setScaleToCropCenter(true);
	RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth);
	rlThumb.addView(aivThumb, rllp);
	aivThumb.setOnClickListener(this);
	initThumb(aivThumb);

	xvRemove = new XView(activity);
	xvRemove.setRatio(ratio);
	rllp = new RelativeLayout.LayoutParams(xWidth, xWidth);
	rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
	rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	rlThumb.addView(xvRemove, rllp);
	xvRemove.setOnClickListener(this);
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:49,代码来源:EditPageLand.java

示例7: onCreate

import android.widget.RelativeLayout; //导入方法依赖的package包/类
public void onCreate() {
	super.onCreate();

	int screenHeight = ResHelper.getScreenHeight(activity);
	float ratio = ((float) screenHeight) / DESIGN_SCREEN_WIDTH;

	maxBodyHeight = 0;

	llPage = new LinearLayout(activity);
	llPage.setOrientation(LinearLayout.VERTICAL);
	activity.setContentView(llPage);

	rlTitle = new RelativeLayout(activity);
	rlTitle.setBackgroundColor(0xffe6e9ec);
	int titleHeight = (int) (DESIGN_TITLE_HEIGHT_L * ratio);

	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight);
	llPage.addView(rlTitle, lp);
	initTitle(rlTitle, ratio);

	RelativeLayout rlBody = new RelativeLayout(activity);
	rlBody.setBackgroundColor(0xffffffff);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(rlBody, lp);
	initBody(rlBody, ratio);

	LinearLayout llShadow = new LinearLayout(activity);
	llShadow.setOrientation(LinearLayout.VERTICAL);
	rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	initShadow(llShadow, ratio);

	llBottom = new LinearLayout(activity);
	llBottom.setOrientation(LinearLayout.VERTICAL);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(llBottom, lp);
	initBottom(llBottom, ratio);
}
 
开发者ID:AndroidBoySC,项目名称:Mybilibili,代码行数:38,代码来源:EditPageLand.java

示例8: initView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void initView() {
    headerBack = (TextView) findViewById(R.id.headerBack);
    headerText = (TextView) findViewById(R.id.headerText);
    headerSubmit = (TextView) findViewById(R.id.headerSubmit);
    layoutheader = (RelativeLayout) findViewById(R.id.layout_header);
    viewpager = (HackyViewPager) findViewById(R.id.view_pager);
    viewpager.setAdapter(new SamplePagerAdapter());
    viewpager.setCurrentItem(position);
    if(stausBarColor!=0){
        StatusBar.setColor(this,stausBarColor);
    }else{
        StatusBar.setColor(this, ContextCompat.getColor(this,R.color.colorPrimary));
    }
    if(mainBackgroud!=0){
        layoutheader.setBackgroundColor(mainBackgroud);
    }else{
        layoutheader.setBackgroundColor(ContextCompat.getColor(this,R.color.colorPrimary));
    }
    if(backIcon!=0){
        setTitleBackIcon(backIcon);
    }
    if(titleColour!=0){
        headerText.setTextColor(titleColour);
    }
    if(backColour!=0){
        headerBack.setTextColor(backColour);
    }
    if(!TextUtils.isEmpty(title)){
        setTitleCenter(title);
    }
    if(!TextUtils.isEmpty(backTitle)){
        setTitleBack(backTitle);
    }
    if(!TextUtils.isEmpty(submitTitle)){
        setTitleSubmit(submitTitle);
    }
}
 
开发者ID:haoxiongqin,项目名称:One_NineGrid,代码行数:38,代码来源:DisplayImgActivity.java

示例9: onCreate

import android.widget.RelativeLayout; //导入方法依赖的package包/类
public void onCreate() {
	super.onCreate();

	int screenHeight = R.getScreenHeight(activity);
	float ratio = ((float) screenHeight) / DESIGN_SCREEN_WIDTH;

	maxBodyHeight = 0;

	llPage = new LinearLayout(activity);
	llPage.setOrientation(LinearLayout.VERTICAL);
	activity.setContentView(llPage);

	rlTitle = new RelativeLayout(activity);
	rlTitle.setBackgroundColor(0xffe6e9ec);
	int titleHeight = (int) (DESIGN_TITLE_HEIGHT_L * ratio);

	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight);
	llPage.addView(rlTitle, lp);
	initTitle(rlTitle, ratio);

	RelativeLayout rlBody = new RelativeLayout(activity);
	rlBody.setBackgroundColor(0xffffffff);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(rlBody, lp);
	initBody(rlBody, ratio);

	LinearLayout llShadow = new LinearLayout(activity);
	llShadow.setOrientation(LinearLayout.VERTICAL);
	rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	initShadow(llShadow, ratio);

	llBottom = new LinearLayout(activity);
	llBottom.setOrientation(LinearLayout.VERTICAL);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(llBottom, lp);
	initBottom(llBottom, ratio);
}
 
开发者ID:wp521,项目名称:MyFire,代码行数:38,代码来源:EditPageLand.java

示例10: initGlobalViews

import android.widget.RelativeLayout; //导入方法依赖的package包/类
/**
 * 初始化全局视图
 *
 * @param context
 */
private void initGlobalViews(Context context) {
    ViewGroup.LayoutParams globalParams = new ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT);
    setLayoutParams(globalParams);

    // 构建标题栏填充视图
    boolean supprotStatusBarLightMode = false;
    try {
        supprotStatusBarLightMode = TitleCompatibilityUtil.supportStatusBarLightMode(getContext());
    } catch (ClassCastException e) {
        e.printStackTrace();
    }
    if (fillStatusBar && supprotStatusBarLightMode) {
        int statusBarHeight = TitleCompatibilityUtil.getStatusBarHeight();
        viewStatusBarFill = new View(context);
        viewStatusBarFill.setId(ViewFinder.generateViewId());
        viewStatusBarFill.setBackgroundColor(statusBarColor);
        LayoutParams statusBarParams = new LayoutParams(MATCH_PARENT, statusBarHeight);
        statusBarParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        addView(viewStatusBarFill, statusBarParams);
    }

    // 构建主视图
    rlMain = new RelativeLayout(context);
    rlMain.setId(ViewFinder.generateViewId());
    rlMain.setBackgroundColor(titleBarColor);
    LayoutParams mainParams = new LayoutParams(MATCH_PARENT, titleBarHeight);
    if (fillStatusBar) {
        if (viewStatusBarFill != null)
            mainParams.addRule(RelativeLayout.BELOW, viewStatusBarFill.getId());
    } else {
        mainParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    }

    // 计算主布局高度
    if (showBottomLine) {
        mainParams.height = titleBarHeight - Math.max(1, ScreenUtils.dp2PxInt(0.4f));
    } else {
        mainParams.height = titleBarHeight;
    }
    addView(rlMain, mainParams);

    // 构建分割线视图
    if (showBottomLine) {
        // 已设置显示标题栏分隔线,5.0以下机型,显示分隔线
        viewBottomLine = new View(context);
        viewBottomLine.setBackgroundColor(bottomLineColor);
        LayoutParams bottomLineParams = new LayoutParams(MATCH_PARENT, Math.max(1, ScreenUtils.dp2PxInt(0.4f)));
        bottomLineParams.leftMargin = ScreenUtils.dp2PxInt(15f);
        bottomLineParams.rightMargin = ScreenUtils.dp2PxInt(15f);
        bottomLineParams.addRule(RelativeLayout.BELOW, rlMain.getId());

        addView(viewBottomLine, bottomLineParams);
        mFadeViewList.add(viewBottomLine);
    }
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:61,代码来源:CommonTitleBar.java

示例11: initBody

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void initBody(RelativeLayout rlBody, float ratio) {
	svContent = new ScrollView(activity);
	rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

	LinearLayout llContent = new LinearLayout(activity);
	llContent.setOrientation(LinearLayout.VERTICAL);
	svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

	etContent = new EditText(activity);
	int padding = (int) (DESIGN_LEFT_PADDING * ratio);
	etContent.setPadding(padding, padding, padding, padding);
	etContent.setBackgroundDrawable(null);
	etContent.setTextColor(0xff3b3b3b);
	etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
	etContent.setText(sp.getText());
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llContent.addView(etContent, lp);
	etContent.addTextChangedListener(this);

	rlThumb = new RelativeLayout(activity);
	rlThumb.setBackgroundColor(0xff313131);
	int	thumbWidth = (int) (DESIGN_THUMB_HEIGHT * ratio);
	int	xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT * ratio);
	lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth);
	lp.leftMargin = lp.rightMargin = lp.bottomMargin = lp.topMargin = padding;
	llContent.addView(rlThumb, lp);

	aivThumb = new AsyncImageView(activity) {
		public void onImageGot(String url, Bitmap bm) {
			thumb = bm;
			super.onImageGot(url, bm);
		}
	};
	aivThumb.setScaleToCropCenter(true);
	RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth);
	rlThumb.addView(aivThumb, rllp);
	aivThumb.setOnClickListener(this);
	initThumb(aivThumb);

	xvRemove = new XView(activity);
	xvRemove.setRatio(ratio);
	rllp = new RelativeLayout.LayoutParams(xWidth, xWidth);
	rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
	rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	rlThumb.addView(xvRemove, rllp);
	xvRemove.setOnClickListener(this);
}
 
开发者ID:ittianyu,项目名称:POCenter,代码行数:48,代码来源:EditPagePort.java


注:本文中的android.widget.RelativeLayout.setBackgroundColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。