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


Java CardView.getLayoutParams方法代码示例

本文整理汇总了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);
}
 
开发者ID:auv1107,项目名称:TextEmoji,代码行数:25,代码来源:EmojiFragment.java

示例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);
        }


    }

}
 
开发者ID:shiburagi,项目名称:Drawer-Behavior,代码行数:39,代码来源:AdvanceDrawerLayout.java

示例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();
    }

}
 
开发者ID:hitanshu-dhawan,项目名称:PopCorn,代码行数:56,代码来源:PersonDetailActivity.java


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