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


Java CardView.setUseCompatPadding方法代码示例

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


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

示例1: SetNewContents

import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private void SetNewContents(int key) {
    if (!Changes(key).equals("null")) {
        CardView.LayoutParams param = new CardView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        CardView card = new CardView(this);
        if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("DARK_THEME_KEY", false))
            card.setCardBackgroundColor(ContextCompat.getColor(this, R.color.DarkcolorPrimary));
        card.setCardElevation(5);
        card.setLayoutParams(param);
        card.setPadding(ConvertTopx(15), ConvertTopx(15), ConvertTopx(15), ConvertTopx(15));
        card.setUseCompatPadding(true);
        TextView changes = new TextView(this);
        changes.setGravity(Gravity.CENTER);
        changes.setPadding(ConvertTopx(5), ConvertTopx(5), ConvertTopx(5), ConvertTopx(5));
        changes.setText(Changes(key));
        changes.setTypeface(Typeface.MONOSPACE);
        if (firebaseRemoteConfig.getBoolean("mark_red") && key == 0)
            changes.setTextColor(Color.RED);
        card.addView(changes);
        layout.addView(card);
    }
    bar.setVisibility(View.GONE);
}
 
开发者ID:coder3101,项目名称:Matrix-Calculator-for-Android,代码行数:24,代码来源:ChangeLogActivity.java

示例2: init

import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private void init() {
    LinearLayout frame = new LinearLayout(context);
    CardView card = new CardView(context);

    card.setUseCompatPadding(true);
    card.setContentPadding(MainActivity.dp(8), MainActivity.dp(8), MainActivity.dp(8), MainActivity.dp(8));
    card.setCardElevation(12.f);

    card.addView(layout);
    frame.addView(card);

    this.setContentView(frame);
    this.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    this.setFocusable(true);
    this.setBackgroundDrawable(new BitmapDrawable());
    this.setOutsideTouchable(true);
}
 
开发者ID:Su-Yong,项目名称:KakaoBot,代码行数:18,代码来源:SettingPopup.java

示例3: onCreateViewHolder

import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(final ViewGroup parent, final int viewType) {
    if (viewType == VIEW_TYPE_TRANSACTION) {
        if (useCards) {
            final CardView cardView = (CardView) inflater.inflate(R.layout.transaction_row_card, parent, false);
            cardView.setPreventCornerOverlap(false);
            cardView.setUseCompatPadding(true);
            return new TransactionViewHolder(cardView);
        } else {
            return new TransactionViewHolder(inflater.inflate(R.layout.transaction_row, parent, false));
        }
    } else if (viewType == VIEW_TYPE_WARNING) {
        return new WarningViewHolder(inflater.inflate(R.layout.transaction_row_warning, parent, false));
    } else {
        throw new IllegalStateException("unknown type: " + viewType);
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:18,代码来源:TransactionsAdapter.java

示例4: onCreateViewHolder

import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int position) {
    View view;
    if (mItems.get(position).cacheable()) {
        if (mViews.containsKey(mItems.get(position))) {
            view = mViews.get(mItems.get(position));
        } else {
            mViews.put(mItems.get(position), view = LayoutInflater.from(parent.getContext())
                    .inflate(mItems.get(position).getLayoutRes(), parent, false));
        }
    } else {
        view = LayoutInflater.from(parent.getContext())
                .inflate(mItems.get(position).getLayoutRes(), parent, false);
    }
    ViewGroup viewGroup = (ViewGroup) view.getParent();
    if (viewGroup != null) {
        viewGroup.removeView(view);
    }
    if (mItems.get(position).cardCompatible()
            && Prefs.getBoolean("forcecards", false, view.getContext())) {
        CardView cardView = new CardView(view.getContext());
        cardView.setRadius(view.getResources().getDimension(R.dimen.cardview_radius));
        cardView.setCardElevation(view.getResources().getDimension(R.dimen.cardview_elevation));
        cardView.setUseCompatPadding(true);
        cardView.setFocusable(false);
        cardView.addView(view);
        view = cardView;
    }
    if (position == 0) {
        mFirstItem = view;
    }
    mItems.get(position).setOnViewChangeListener(mOnViewChangedListener);
    mItems.get(position).onCreateHolder(parent, view);
    return new RecyclerView.ViewHolder(view) {
    };
}
 
开发者ID:morogoku,项目名称:MTweaks-KernelAdiutorMOD,代码行数:37,代码来源:RecyclerViewAdapter.java

示例5: initZoomRegionView

import android.support.v7.widget.CardView; //导入方法依赖的package包/类
/**
 * Init the ZoomRegionView for navigate into image when user zoom in
 */
private void initZoomRegionView() {
    if (mZoomRegionView == null) {

        Bitmap init = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
        mContentBitmap = init.copy(Bitmap.Config.ARGB_8888, true);
        init.recycle();
        mContentCanvas = new Canvas(mContentBitmap);

        FrameLayout.LayoutParams layoutParams = new LayoutParams(getWidth() / 4, getHeight() / 4,
                Gravity.TOP | Gravity.END);
        layoutParams.setMargins(12, 12, 12, 12);
        mZoomRegionCardView = new CardView(getContext());
        mZoomRegionCardView.setLayoutParams(layoutParams);
        mZoomRegionCardView.setPreventCornerOverlap(true);
        mZoomRegionCardView.setRadius(0f);
        mZoomRegionCardView.setUseCompatPadding(true);
        mZoomRegionCardView.setVisibility(View.INVISIBLE);

        CardView.LayoutParams childLayoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        mZoomRegionView = new ZoomRegionView(getContext());
        mZoomRegionView.setLayoutParams(childLayoutParams);
        mZoomRegionView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        mZoomRegionView.setOnZoomRegionListener(new ZoomRegionView.OnZoomRegionListener() {
            @Override
            public void onZoomRegionMoved(Rect newRect) {
                mFromZoomRegion = true;
                mZoomCenterX = newRect.centerX() * 4;
                mZoomCenterY = newRect.centerY() * 4;

                invalidate();
            }
        });

        mZoomRegionCardView.addView(mZoomRegionView);
        addView(mZoomRegionCardView);
    }
}
 
开发者ID:rosenpin,项目名称:QuickDrawEverywhere,代码行数:42,代码来源:DrawView.java


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