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


Java FrameLayout.setBackgroundResource方法代码示例

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


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

示例1: ChatLoadingCell

import android.widget.FrameLayout; //导入方法依赖的package包/类
public ChatLoadingCell(Context context) {
    super(context);

    frameLayout = new FrameLayout(context);
    frameLayout.setBackgroundResource(R.drawable.system_loader);
    frameLayout.getBackground().setColorFilter(Theme.colorFilter);
    addView(frameLayout, LayoutHelper.createFrame(36, 36, Gravity.CENTER));

    ProgressBar progressBar = new ProgressBar(context);
    try {
        progressBar.setIndeterminateDrawable(getResources().getDrawable(R.drawable.loading_animation));
    } catch (Exception e) {
        //don't promt
    }
    progressBar.setIndeterminate(true);
    AndroidUtilities.setProgressBarAnimationDuration(progressBar, 1500);
    frameLayout.addView(progressBar, LayoutHelper.createFrame(32, 32, Gravity.CENTER));
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:19,代码来源:ChatLoadingCell.java

示例2: makeColorPresetButton

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void makeColorPresetButton(int color) {
        FrameLayout outframe = new FrameLayout(getContext());
        outframe.setBackgroundColor(Color.BLACK);
        outframe.setPadding(6,6,6,6);

        FrameLayout frame = new FrameLayout(getContext());
        //frame.setBackgroundColor(Color.BLACK);
        frame.setBackgroundResource(R.drawable.transparentgrid);

        TextView c = new TextView(getContext());
        c.setText("   ");
        c.setTextSize(22);
        c.setBackgroundColor(color);
//        if (color==Color.TRANSPARENT) {
//            c.setBackgroundResource(R.drawable.transparentgrid);
//        }
        c.setTag(color);
        c.setClickable(true);
        c.setOnClickListener(setColorListener);
        frame.addView(c);
        GridLayout.LayoutParams lp = new GridLayout.LayoutParams();
        lp.setMargins(24, 16, 24, 16);
        outframe.setPadding(6,6,6,6);
        outframe.addView(frame);
        colorPresets.addView(outframe, lp);
    }
 
开发者ID:quaap,项目名称:LaunchTime,代码行数:27,代码来源:ColorChooser.java

示例3: initGuideViews

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void initGuideViews() {
        LayoutInflater inflater = getLayoutInflater();
        FrameLayout guideOne = (FrameLayout) inflater.inflate(R.layout.guide_viewpage_one, null);
        FrameLayout guideTwo = (FrameLayout) inflater.inflate(R.layout.guide_viewpage_one, null);
        FrameLayout guideThree = (FrameLayout) inflater.inflate(R.layout.guide_viewpage_one, null);
        FrameLayout guideFour = (FrameLayout) inflater.inflate(R.layout.guide_viewpage_two, null);
        TextView skip = (TextView) guideFour.findViewById(R.id.guide_tv);
        skip.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(GuideActivity.this,MainActivity.class));
                finish();
            }
        });

        guideOne.setBackgroundResource(R.drawable.guide_1);
        guideTwo.setBackgroundResource(R.drawable.guide_2);
        guideThree.setBackgroundResource(R.drawable.guide_3);
        guideFour.setBackgroundResource(R.drawable.guide_4);
//            skip.setBackgroundResource(R.drawable.guide_ver3_zh_open);
        //其他语言图片待添加
        guideViews.add(guideOne);
        guideViews.add(guideTwo);
        guideViews.add(guideThree);
        guideViews.add(guideFour);
    }
 
开发者ID:supremezzz,项目名称:Supreme,代码行数:27,代码来源:GuideActivity.java

示例4: createBottomSelectionBar

import android.widget.FrameLayout; //导入方法依赖的package包/类
/**
     * Creates bottom selection bar to show selected days
     */
    private void createBottomSelectionBar() {
        flBottomSelectionBar = new FrameLayout(getContext());
//        flBottomSelectionBar.setLayoutTransition(new LayoutTransition());
        flBottomSelectionBar.setId(View.generateViewId());
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.addRule(RelativeLayout.BELOW, rvMonths.getId());
        flBottomSelectionBar.setLayoutParams(params);
        flBottomSelectionBar.setBackgroundResource(R.drawable.border_top_bottom);
        flBottomSelectionBar.setVisibility(settingsManager.getCalendarOrientation() == OrientationHelper.HORIZONTAL ? View.VISIBLE : View.GONE);
        addView(flBottomSelectionBar);

        createMultipleSelectionBarRecycler();
        createRangeSelectionLayout();
    }
 
开发者ID:ApplikeySolutions,项目名称:CosmoCalendar,代码行数:18,代码来源:CalendarView.java

示例5: ChatUnreadCell

import android.widget.FrameLayout; //导入方法依赖的package包/类
public ChatUnreadCell(Context context) {
    super(context);

    FrameLayout frameLayout = new FrameLayout(context);
    frameLayout.setBackgroundResource(R.drawable.newmsg_divider);
    SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
    int bgColor = themePrefs.getInt("chatDateBubbleColor", 0xccffffff);
    if(bgColor != 0xccffffff)frameLayout.setBackgroundColor(bgColor);
    addView(frameLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 27, Gravity.LEFT | Gravity.TOP, 0, 7, 0, 0));

    ImageView imageView = new ImageView(context);
    //imageView.setImageResource(R.drawable.ic_ab_new);
    int color = themePrefs.getInt("chatDateColor", 0xffA2B5C7);
    Drawable abNew = getResources().getDrawable(R.drawable.ic_ab_new);
    abNew.setColorFilter(color, PorterDuff.Mode.SRC_IN);
    imageView.setImageDrawable(abNew);
    imageView.setPadding(0, AndroidUtilities.dp(2), 0, 0);
    frameLayout.addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 10, 0));

    textView = new TextView(context);
    textView.setPadding(0, 0, 0, AndroidUtilities.dp(1));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    //textView.setTextColor(Theme.CHAT_UNREAD_TEXT_COLOR);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    int textColor = themePrefs.getInt("chatDateColor", 0xff4a7297);
    textView.setTextColor(textColor);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:29,代码来源:ChatUnreadCell.java

示例6: buttonForBrush

import android.widget.FrameLayout; //导入方法依赖的package包/类
private FrameLayout buttonForBrush(final int brush, int resource, boolean selected) {
    FrameLayout button = new FrameLayout(getContext());
    button.setBackgroundResource(R.drawable.list_selector);
    button.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            setBrush(brush);

            if (popupWindow != null && popupWindow.isShowing()) {
                popupWindow.dismiss(true);
            }
        }
    });

    ImageView preview = new ImageView(getContext());
    preview.setImageResource(resource);
    button.addView(preview, LayoutHelper.createFrame(165, 44, Gravity.LEFT | Gravity.CENTER_VERTICAL, 46, 0, 8, 0));

    if (selected) {
        ImageView check = new ImageView(getContext());
        check.setImageResource(R.drawable.ic_ab_done_gray);
        check.setScaleType(ImageView.ScaleType.CENTER);
        button.addView(check, LayoutHelper.createFrame(50, LayoutHelper.MATCH_PARENT));
    }

    return button;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:28,代码来源:PhotoPaintView.java

示例7: buttonForText

import android.widget.FrameLayout; //导入方法依赖的package包/类
private FrameLayout buttonForText(final boolean stroke, String text, boolean selected) {
    FrameLayout button = new FrameLayout(getContext()) {
        @Override
        public boolean onInterceptTouchEvent(MotionEvent ev) {
            return true;
        }
    };
    button.setBackgroundResource(R.drawable.list_selector);
    button.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            setStroke(stroke);

            if (popupWindow != null && popupWindow.isShowing()) {
                popupWindow.dismiss(true);
            }
        }
    });

    EditTextOutline textView = new EditTextOutline(getContext());
    textView.setBackgroundColor(Color.TRANSPARENT);
    textView.setEnabled(false);
    textView.setStrokeWidth(AndroidUtilities.dp(3));
    textView.setTextColor(stroke ? Color.WHITE : Color.BLACK);
    textView.setStrokeColor(stroke ? Color.BLACK : Color.TRANSPARENT);
    textView.setPadding(AndroidUtilities.dp(2), 0, AndroidUtilities.dp(2), 0);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    textView.setTypeface(null, Typeface.BOLD);
    textView.setTag(stroke);
    textView.setText(text);
    button.addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 46, 0, 16, 0));

    if (selected) {
        ImageView check = new ImageView(getContext());
        check.setImageResource(R.drawable.ic_ab_done_gray);
        check.setScaleType(ImageView.ScaleType.CENTER);
        button.addView(check, LayoutHelper.createFrame(50, LayoutHelper.MATCH_PARENT));
    }

    return button;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:42,代码来源:PhotoPaintView.java

示例8: updateTabStyles

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void updateTabStyles() {
    for (int i = 0; i < tabCount; i++) {
        FrameLayout frameLayout = (FrameLayout) tabsContainer.getChildAt(i);
        frameLayout.setBackgroundResource(tabBackgroundResId);

        for (int j = 0; j < frameLayout.getChildCount(); j++) {
            View v = frameLayout.getChildAt(j);
            if (v instanceof TextView) {
                TextView tab = (TextView) v;
                tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
                tab.setTypeface(tabTypeface, tabTypefaceStyle);
                tab.setPadding(tabPadding, 0, tabPadding, 0);
                if (j == 0) {
                    tab.setTextColor(tabTextColor);
                } else {
                    tab.setTextColor(selectedTabTextColor);
                }
                ViewHelper.setAlpha(tabViews.get(i).get("normal"), 1);
                ViewHelper.setAlpha(tabViews.get(i).get("selected"), 0);

                //set normal  Scale
                ViewHelper.setPivotX(frameLayout, frameLayout.getMeasuredWidth() * 0.5f);
                ViewHelper.setPivotY(frameLayout, frameLayout.getMeasuredHeight() * 0.5f);
                ViewHelper.setScaleX(frameLayout, 1f);
                ViewHelper.setScaleY(frameLayout, 1f);

                // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
                // pre-ICS-build
                if (textAllCaps) {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                        tab.setAllCaps(true);
                    } else {
                        tab.setText(tab.getText().toString().toUpperCase(locale));
                    }
                }
                if (i == selectedPosition) {
                    ViewHelper.setAlpha(tabViews.get(i).get("normal"), 0);
                    ViewHelper.setAlpha(tabViews.get(i).get("selected"), 1);

                    //set select  Scale
                    ViewHelper.setPivotX(frameLayout, frameLayout.getMeasuredWidth() * 0.5f);
                    ViewHelper.setPivotY(frameLayout, frameLayout.getMeasuredHeight() * 0.5f);
                    ViewHelper.setScaleX(frameLayout, 1 + zoomMax);
                    ViewHelper.setScaleY(frameLayout, 1 + zoomMax);
                }
            }
        }
    }
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:50,代码来源:PagerSlidingTabStrip.java

示例9: getCourseBackView

import android.widget.FrameLayout; //导入方法依赖的package包/类
/**
 * 每个课程格子的背景
 * @return
 */
public View getCourseBackView() {
    FrameLayout courseBackView = new FrameLayout(mContext);
    courseBackView.setBackgroundResource(R.drawable.course_back);
    return courseBackView;
}
 
开发者ID:huangshuai-IOT,项目名称:SScheduleView-Android,代码行数:10,代码来源:CustomSSViewAdapter.java


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