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


Java ViewGroup.setBackgroundResource方法代码示例

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


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

示例1: attachToActivity

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * 设置关联的 Activity
 * 重要!必须调用
 *
 * @param activity
 */
public void attachToActivity(Activity activity, @EdgeFlag int edgeFlag) {
    mAttachActivity = activity;
    TypedArray a = activity.getTheme().obtainStyledAttributes(new int[]{
            android.R.attr.windowBackground
    });
    int background = a.getResourceId(0, 0);
    a.recycle();

    ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView();
    ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
    decorChild.setBackgroundResource(background);
    decor.removeView(decorChild);
    addView(decorChild);
    _setContentView(decorChild);
    decor.addView(this);
    setEdgeFlag(edgeFlag);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:SwipeBackLayout.java

示例2: configureCard

import android.view.ViewGroup; //导入方法依赖的package包/类
private void configureCard(ViewGroup card) {
    cardContent.setMaxWidth(getCardWidth());
    cardContent.setPadding(
            CARD_PADDING_VERTICAL,
            CARD_PADDING_HORIZONTAL,
            CARD_PADDING_VERTICAL,
            CARD_PADDING_HORIZONTAL
    );
    cardContent.setLayoutParams(new FrameLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT
    ));

    card.setBackgroundResource(getCardBackgroundDrawable());
    card.addView(cardContent);

    FrameLayout.LayoutParams cardLayoutParams = generateDefaultLayoutParams();
    cardLayoutParams.width = LayoutParams.WRAP_CONTENT;
    cardLayoutParams.height = LayoutParams.WRAP_CONTENT;
    cardLayoutParams.gravity = getCardGravity();
    cardLayoutParams.leftMargin = getCardMarginLeft();
    cardLayoutParams.topMargin = getCardMarginTop();
    cardLayoutParams.rightMargin = getCardMarginRight();
    cardLayoutParams.bottomMargin = getCardMarginBottom();
    card.setLayoutParams(cardLayoutParams);
}
 
开发者ID:dimorinny,项目名称:show-case-card-view,代码行数:27,代码来源:ShowCaseView.java

示例3: attachToActivity

import android.view.ViewGroup; //导入方法依赖的package包/类
public void attachToActivity(Activity activity) {
    mActivity = activity;
    TypedArray a = activity.getTheme().obtainStyledAttributes(new int[]{
            android.R.attr.windowBackground
    });
    int background = a.getResourceId(0, 0);
    a.recycle();

    ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView();
    ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
    decorChild.setBackgroundResource(background);
    decor.removeView(decorChild);
    addView(decorChild);
    setContentView(decorChild);
    decor.addView(this);
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:17,代码来源:SwipeBackLayout.java

示例4: attachToActivity

import android.view.ViewGroup; //导入方法依赖的package包/类
public void attachToActivity(FragmentActivity activity) {
    mActivity = activity;
    TypedArray a = activity.getTheme().obtainStyledAttributes(new int[]{
            android.R.attr.windowBackground
    });
    int background = a.getResourceId(0, 0);
    a.recycle();

    ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView();
    ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
    decorChild.setBackgroundResource(background);
    decor.removeView(decorChild);
    addView(decorChild);
    setContentView(decorChild);
    decor.addView(this);
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:17,代码来源:SwipeBackLayout.java

示例5: attachToActivity

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * 将SwipeFinishLayout关联到指定activity中
 * @param activity
 */
public void attachToActivity(Activity activity) {
    mActivity = activity;
    TypedArray ta = activity.getTheme().obtainStyledAttributes(
            new int[] {android.R.attr.windowBackground});
    int background = ta.getResourceId(0, 0);
    ta.recycle();

    // 设置window样式,FEATURE_NO_TITLE
    activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
    ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
    // 系统内置,/platforms/android-25/data/res/layout/screen_custom_title.xml
    ViewGroup decorChild = (ViewGroup) decorView.getChildAt(0);
    decorChild.setBackgroundResource(background);
    decorView.removeView(decorChild);
    addView(decorChild);
    // 设置content view
    mContentView = (View) decorChild.getParent();
    // 将SwipeFinishLayout添加到decorView中
    decorView.addView(this);
}
 
开发者ID:lorienzhang,项目名称:SwipeFinishLayout,代码行数:25,代码来源:SwipeFinishLayout.java

示例6: setViewPadding

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * 调整位置Padding
 * @param parent
 * @param background
 */
private void setViewPadding(ViewGroup parent, int background) {
    int[] rect = new int[4];
    rect[0] = parent.getPaddingLeft();
    rect[1] = parent.getPaddingTop();
    rect[2] = parent.getPaddingRight();
    rect[3] = parent.getPaddingBottom();
    parent.setBackgroundResource(background);
    parent.setPadding(rect[0], rect[1], rect[2], rect[3]);
}
 
开发者ID:NewCasino,项目名称:browser,代码行数:15,代码来源:OverflowAdapter.java

示例7: getSelectorDialog

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * menu action selector Dialog
 *
 * @return dialog
 */
private Dialog getSelectorDialog() {
    if (mSelectorDialog == null) {
        mSelectorDialog = new BottomDialog(this, true);
        @SuppressLint("InflateParams") View view = LayoutInflater.from(this).inflate(R.layout.view_nearby_operator, null, false);
        view.findViewById(R.id.tv_clear_opt).setOnClickListener(this);
        view.findViewById(R.id.tv_cancel_opt).setOnClickListener(this);
        mSelectorDialog.setContentView(view);
        ViewGroup parent = (ViewGroup) view.getParent();
        if (parent != null) {
            parent.setBackgroundResource(R.color.transparent);
        }
    }
    return mSelectorDialog;
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:20,代码来源:NearbyActivity.java

示例8: attachToActivity

import android.view.ViewGroup; //导入方法依赖的package包/类
public void attachToActivity(Activity activity) {
    mActivity = activity;
    TypedArray a = activity.getTheme().obtainStyledAttributes(
            new int[]{android.R.attr.windowBackground});
    int background = a.getResourceId(0, 0);
    a.recycle();

    ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView();
    ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
    decorChild.setBackgroundResource(background);
    decor.removeView(decorChild);
    addView(decorChild);
    setContentView(decorChild);
    decor.addView(this);
}
 
开发者ID:haihaio,项目名称:AmenEye,代码行数:16,代码来源:SwipeBackLayout.java

示例9: attachToActivity

import android.view.ViewGroup; //导入方法依赖的package包/类
public void attachToActivity(Activity activity) {
    this.mActivity = activity;
    TypedArray a = activity.getTheme().obtainStyledAttributes(new int[]{16842836});
    int background = a.getResourceId(0, 0);
    a.recycle();
    ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView();
    ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
    decorChild.setBackgroundResource(background);
    decor.removeView(decorChild);
    addView(decorChild);
    setContentView(decorChild);
    decor.addView(this);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:SwipeBackLayout.java


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