本文整理汇总了Java中android.support.v7.widget.CardView.setRadius方法的典型用法代码示例。如果您正苦于以下问题:Java CardView.setRadius方法的具体用法?Java CardView.setRadius怎么用?Java CardView.setRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.CardView
的用法示例。
在下文中一共展示了CardView.setRadius方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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) {
};
}
示例2: 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);
}
}
示例3: addView
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
public void addView(View child) {
if (child instanceof NavigationView) {
super.addView(child);
} else {
CardView cardView = new CardView(getContext());
cardView.setRadius(0);
cardView.addView(child);
cardView.setCardElevation(0);
frameLayout.addView(cardView);
}
}
示例4: updateSlideOffset
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private void updateSlideOffset(View drawerView, float slideOffset) {
final int absHorizGravity = getDrawerViewAbsoluteGravity(Gravity.START);
final int childAbsGravity = getDrawerViewAbsoluteGravity(drawerView);
for (int i = 0; i < frameLayout.getChildCount(); i++) {
CardView child = (CardView) frameLayout.getChildAt(i);
Setting setting = settings.get(childAbsGravity);
float adjust = 0;
if (setting != null) {
child.setRadius((int) (setting.radius * slideOffset));
super.setScrimColor(setting.scrimColor);
super.setDrawerElevation(setting.drawerElevation);
float percentage = 1f - setting.percentage;
float reduceHeight = getHeight() * percentage * slideOffset;
FrameLayout.LayoutParams params
= (FrameLayout.LayoutParams) child.getLayoutParams();
params.topMargin = (int) (reduceHeight / 2);
params.bottomMargin = (int) (reduceHeight / 2);
child.setLayoutParams(params);
child.setCardElevation(setting.elevation * slideOffset);
adjust = setting.elevation;
float width = childAbsGravity == absHorizGravity ?
drawerView.getWidth() + adjust : -drawerView.getWidth() - adjust;
ViewCompat.setX(child, width * slideOffset);
} else {
super.setScrimColor(defaultScrimColor);
super.setDrawerElevation(defaultDrawerElevation);
}
}
}
示例5: addCardCorners
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private void addCardCorners() {
final CardView cardView = (CardView) findViewById(R.id.cs_card);
cardView.setRadius(25f);
}
示例6: addCardCorners
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private void addCardCorners() {
final CardView cardView = (CardView) findViewById(R.id.card);
cardView.setRadius(25f);
}
示例7: onCreate
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_person_detail);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setTitle("");
Intent receivedIntent = getIntent();
mPersonId = receivedIntent.getIntExtra(Constant.PERSON_ID, -1);
if (mPersonId == -1) finish();
mCollapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
mAppBarLayout = (AppBarLayout) findViewById(R.id.app_bar);
mCastImageCardView = (CardView) findViewById(R.id.card_view_cast_detail);
mCastImageSideSize = (int) (getResources().getDisplayMetrics().widthPixels * 0.33);
mCastImageCardView.getLayoutParams().height = mCastImageSideSize;
mCastImageCardView.getLayoutParams().width = mCastImageSideSize;
mCastImageCardView.setRadius(mCastImageSideSize / 2);
mCastImageView = (ImageView) findViewById(R.id.image_view_cast_detail);
mProgressBar = (AVLoadingIndicatorView) findViewById(R.id.progress_bar_cast_detail);
mProgressBar.setVisibility(View.GONE);
mCastNameTextView = (TextView) findViewById(R.id.text_view_name_cast_detail);
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mCastNameTextView.getLayoutParams();
params.setMargins(params.leftMargin, mCastImageSideSize / 3, params.rightMargin, params.bottomMargin);
mCastAgeTextView = (TextView) findViewById(R.id.text_view_age_cast_detail);
mCastBirthPlaceTextView = (TextView) findViewById(R.id.text_view_birthplace_cast_detail);
mCastBioHeaderTextView = (TextView) findViewById(R.id.text_view_bio_header_person_detail);
mCastBioTextView = (TextView) findViewById(R.id.text_view_bio_person_detail);
mCastReadMoreBioTextView = (TextView) findViewById(R.id.text_view_read_more_person_detail);
mMovieCastTextView = (TextView) findViewById(R.id.text_view_movie_cast_person_detail);
mMovieCastRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_movie_cast_person_detail);
mMovieCastOfPersons = new ArrayList<>();
mMovieCastsOfPersonAdapter = new MovieCastsOfPersonAdapter(PersonDetailActivity.this, mMovieCastOfPersons);
mMovieCastRecyclerView.setAdapter(mMovieCastsOfPersonAdapter);
mMovieCastRecyclerView.setLayoutManager(new LinearLayoutManager(PersonDetailActivity.this, LinearLayoutManager.HORIZONTAL, false));
mTVCastTextView = (TextView) findViewById(R.id.text_view_tv_cast_person_detail);
mTVCastRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_tv_cast_person_detail);
mTVCastOfPersons = new ArrayList<>();
mTVCastsOfPersonAdapter = new TVCastsOfPersonAdapter(PersonDetailActivity.this, mTVCastOfPersons);
mTVCastRecyclerView.setAdapter(mTVCastsOfPersonAdapter);
mTVCastRecyclerView.setLayoutManager(new LinearLayoutManager(PersonDetailActivity.this, LinearLayoutManager.HORIZONTAL, false));
if (NetworkConnection.isConnected(PersonDetailActivity.this)) {
isActivityLoaded = true;
loadActivity();
}
}