本文整理汇总了Java中android.support.v7.widget.CardView.getLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java CardView.getLayoutParams方法的具体用法?Java CardView.getLayoutParams怎么用?Java CardView.getLayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.CardView
的用法示例。
在下文中一共展示了CardView.getLayoutParams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initViews
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private void initViews(View root) {
mOptions = (CardView) root.findViewById(R.id.options);
mEmojiTager = (EmojiTager) root.findViewById(R.id.emoji_tager);
mEmojiRadioAdapter = new EmojiRadioAdapter(getActivity());
mEmojiPagerAdapter = new EmojiPagerAdapter(getActivity());
mEmojiTager.setRadioGroupAdapter(mEmojiRadioAdapter);
mEmojiTager.setViewPagerAdapter(mEmojiPagerAdapter);
int height = SharePreferencesUtils.getInt(getActivity(),
Constants.SOFT_KEYBOARD_HEIGHT, mSoftKeyboardDefaultHeight);
mEmojiTager.getLayoutParams().height = height;
mOptions.getLayoutParams().height = height;
mEmojiButton = (ImageView) root.findViewById(R.id.emoji_button);
mGifs[0] = (ImageView) root.findViewById(R.id.gif3);
mGifs[1] = (ImageView) root.findViewById(R.id.gif1);
mGifs[2] = (ImageView) root.findViewById(R.id.gif2);
mShareDialog = new ShareDialog(getContext());
mShareDialog.setEmojiAddButtonVisible(false);
mGifSourceSpinner = (Spinner) root.findViewById(R.id.gif_source_spinner);
}
示例2: 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);
}
}
}
示例3: 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();
}
}