Java Code Examples for android.support.v7.widget.CardView#setMaxCardElevation()

The following examples show how to use android.support.v7.widget.CardView#setMaxCardElevation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CardPagerAdapter.java    From MusicPlayer_XiangDa with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Object instantiateItem(ViewGroup container, final int position) {
    View view = LayoutInflater.from(container.getContext()).inflate(R.layout.item_viewpage_adapter, container, false);
    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (cardItemClickListener != null) {
                cardItemClickListener.onClick(position);
            }
        }
    });
    container.addView(view);
    bind(mData.get(position), view);
    CardView cardView = (CardView) view.findViewById(R.id.cardView);

    cardView.setMaxCardElevation(MaxElevationFactor);
    mViews.set(position, cardView);
    return view;
}
 
Example 2
Source File: CardPagerAdapter.java    From ViewPagerCards with Apache License 2.0 6 votes vote down vote up
@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = LayoutInflater.from(container.getContext())
            .inflate(R.layout.adapter, container, false);
    container.addView(view);
    bind(mData.get(position), view);
    CardView cardView = (CardView) view.findViewById(R.id.cardView);

    if (mBaseElevation == 0) {
        mBaseElevation = cardView.getCardElevation();
    }

    cardView.setMaxCardElevation(mBaseElevation * MAX_ELEVATION_FACTOR);
    mViews.set(position, cardView);
    return view;
}
 
Example 3
Source File: CardPagerAdapter.java    From Pano360 with MIT License 6 votes vote down vote up
@Override
public Object instantiateItem(ViewGroup container, final int position) {
    View view = LayoutInflater.from(container.getContext())
            .inflate(R.layout.adapter, container, false);
    view.findViewById(R.id.start).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onClickCallback.onClick(position);
        }
    });
    container.addView(view);
    bind(mData.get(position), view);
    CardView cardView = (CardView) view.findViewById(R.id.cardView);

    if (mBaseElevation == 0) {
        mBaseElevation = cardView.getCardElevation();
    }

    cardView.setMaxCardElevation(mBaseElevation * MAX_ELEVATION_FACTOR);
    mViews.set(position, cardView);
    return view;
}
 
Example 4
Source File: CardPagerAdapter.java    From ViewPagerCards with Apache License 2.0 6 votes vote down vote up
@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = LayoutInflater.from(container.getContext())
            .inflate(R.layout.adapter, container, false);
    container.addView(view);
    bind(mData.get(position), view);
    CardView cardView = (CardView) view.findViewById(R.id.cardView);

    if (mBaseElevation == 0) {
        mBaseElevation = cardView.getCardElevation();
    }

    cardView.setMaxCardElevation(mBaseElevation * MAX_ELEVATION_FACTOR);
    mViews.set(position, cardView);
    return view;
}
 
Example 5
Source File: CardFragment.java    From ViewPagerCards with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_adapter, container, false);
    mCardView = (CardView) view.findViewById(R.id.cardView);
    mCardView.setMaxCardElevation(mCardView.getCardElevation()
            * CardAdapter.MAX_ELEVATION_FACTOR);
    return view;
}
 
Example 6
Source File: CardPagerAdapter.java    From Dictionary with Apache License 2.0 5 votes vote down vote up
@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = LayoutInflater.from(container.getContext())
            .inflate(R.layout.adapter, container, false);
    container.addView(view);
    CardView cardView = (CardView) view.findViewById(R.id.cardView);

    if (mBaseElevation == 0) {
        mBaseElevation = cardView.getCardElevation();
    }
    cardView.setMaxCardElevation(mBaseElevation * MAX_ELEVATION_FACTOR);
    initData(view, position);
    mViews.set(position, cardView);
    return view;
}
 
Example 7
Source File: CardFragment.java    From ViewPagerCards with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_adapter, container, false);
    mCardView = (CardView) view.findViewById(R.id.cardView);
    mCardView.setMaxCardElevation(mCardView.getCardElevation()
            * CardAdapter.MAX_ELEVATION_FACTOR);
    return view;
}