當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。