本文整理匯總了Java中android.support.v7.widget.CardView類的典型用法代碼示例。如果您正苦於以下問題:Java CardView類的具體用法?Java CardView怎麽用?Java CardView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CardView類屬於android.support.v7.widget包,在下文中一共展示了CardView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: SetThisColorToCard
import android.support.v7.widget.CardView; //導入依賴的package包/類
private void SetThisColorToCard(int id) {
//grab all 7 cards
CardView cardView1 = (CardView) findViewById(R.id.QA1);
CardView cardView2 = (CardView) findViewById(R.id.QA2);
CardView cardView3 = (CardView) findViewById(R.id.QA3);
CardView cardView5 = (CardView) findViewById(R.id.QA5);
CardView cardView8 = (CardView) findViewById(R.id.QA8);
CardView cardView9 = (CardView) findViewById(R.id.QA9);
CardView cardView10 = (CardView) findViewById(R.id.QA10);
//set the background color
cardView1.setCardBackgroundColor(id);
cardView2.setCardBackgroundColor(id);
cardView3.setCardBackgroundColor(id);
cardView5.setCardBackgroundColor(id);
cardView8.setCardBackgroundColor(id);
cardView9.setCardBackgroundColor(id);
cardView10.setCardBackgroundColor(id);
}
示例2: onCreate
import android.support.v7.widget.CardView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
setContentView(R.layout.activity_login_registration);
login = (Button) findViewById(R.id.btn_login);
register = (Button) findViewById(R.id.btn_register);
cardView=(CardView)findViewById(R.id.layout2);
splashActivity=new SplashActivity();
login.setOnClickListener(this);
register.setOnClickListener(this);
b=splashActivity.containsPass("password");
if(b==true)
{
register.setVisibility(View.INVISIBLE);
cardView.setVisibility(View.INVISIBLE);
}
}
示例3: onUpdateViewAlpha
import android.support.v7.widget.CardView; //導入依賴的package包/類
@Override
protected void onUpdateViewAlpha(@NonNull View view, float alpha) {
final CardView card = ((CardView)view);
final View alphaView = card.getChildAt(1);
final View imageView = card.getChildAt(0);
final boolean isLeftCard = alpha < 1;
if (isLeftCard) {
ViewCompat.setAlpha(alphaView, 0.9f - alpha);
ViewCompat.setAlpha(imageView, 0.3f + alpha);
} else {
if (ViewCompat.getAlpha(alphaView) != 0) {
ViewCompat.setAlpha(alphaView, 0f);
}
if (ViewCompat.getAlpha(imageView) != 1) {
ViewCompat.setAlpha(imageView, 1f);
}
}
}
示例4: HistoryViewHolders
import android.support.v7.widget.CardView; //導入依賴的package包/類
public HistoryViewHolders(int loaderId, HistoryRecyclerViewAdapter.SelectListener listener, View itemView) {
super(itemView);
mLoaderId = loaderId;
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
mSeparator = (TextView) itemView.findViewById(R.id.separator);
mStartLabel = (TextView) itemView.findViewById(R.id.start_label);
mNoteLabel = (TextView) itemView.findViewById(R.id.note);
mDurationLabel = (TextView) itemView.findViewById(R.id.duration_label);
mSymbol = (ImageView) itemView.findViewById(R.id.picture);
mActivityCardView = (CardView) itemView.findViewById(R.id.activity_card);
mName = (TextView) itemView.findViewById(R.id.activity_name);
mBackground = itemView.findViewById(R.id.activity_background);
mImageRecycler = (RecyclerView)itemView.findViewById(R.id.image_grid);
mListener = listener;
}
示例5: onBindViewHolder
import android.support.v7.widget.CardView; //導入依賴的package包/類
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
if(tech.equals(GankMainFragment.tabTitle[0])) {
((ViewHolder)holder).ivIcon.setImageResource(R.mipmap.ic_android);
} else if(tech.equals(GankMainFragment.tabTitle[1])) {
((ViewHolder)holder).ivIcon.setImageResource(R.mipmap.ic_ios);
} else if(tech.equals(GankMainFragment.tabTitle[2])) {
((ViewHolder)holder).ivIcon.setImageResource(R.mipmap.ic_web);
}
((ViewHolder)holder).tvContent.setText(mList.get(position).getDesc());
((ViewHolder)holder).tvAuthor.setText(mList.get(position).getWho());
((ViewHolder)holder).tvTime.setText(DateUtil.formatDateTime(DateUtil.subStandardTime(mList.get(position).getPublishedAt()), true));
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(onItemClickListener != null) {
CardView cv = (CardView) view.findViewById(R.id.cv_tech_content);
onItemClickListener.onItemClick(holder.getAdapterPosition(),cv);
}
}
});
}
示例6: animateOut
import android.support.v7.widget.CardView; //導入依賴的package包/類
private void animateOut(final CardView view) {
if (animInProgress)
return;
animInProgress = true;
view.setVisibility(View.VISIBLE);
ViewCompat.animate(view).translationX(hiddenPosX)
.setInterpolator(interpolator).withLayer()
.setListener(new ViewPropertyAnimatorListenerAdapter() {
@Override
public void onAnimationEnd(View view1) {
super.onAnimationEnd(view1);
animInProgress = false;
if (currentPos > 400)
animateIn(view);
else animateOut(view);
}
})
.start();
}
示例7: initController
import android.support.v7.widget.CardView; //導入依賴的package包/類
private void initController(final View actionView, final TextView actionTv,
final AppCompatRadioButton serialRb,
final AppCompatRadioButton parallelRb,
final CardView deleteActionView, final View deleteActionTv) {
final QueueController controller = new QueueController();
this.controller = controller;
controller.initTasks(this, new DownloadQueueListener() {
@Override public void queueEnd() {
actionView.setTag(null);
actionTv.setText(R.string.start);
// to cancel
controller.stop();
serialRb.setEnabled(true);
parallelRb.setEnabled(true);
deleteActionView.setEnabled(true);
deleteActionView.setCardElevation((Float) deleteActionView.getTag());
deleteActionTv.setEnabled(true);
adapter.notifyDataSetChanged();
}
});
}
示例8: FABtoSheet
import android.support.v7.widget.CardView; //導入依賴的package包/類
public FABtoSheet(FloatingActionButton fab, CardView card) {
this.floatingActionButton = fab;
this.cardView = card;
startWidth = floatingActionButton.getWidth();
startHeight = floatingActionButton.getHeight();
startLeft = floatingActionButton.getLeft();
startTop = floatingActionButton.getTop();
int startRight = floatingActionButton.getRight();
int startBottom = floatingActionButton.getBottom();
startRect = new Rect(startLeft, startTop, startRight, startBottom);
endWidth = cardView.getWidth();
endHeight = cardView.getHeight();
endLeft = cardView.getLeft();
endTop = cardView.getTop();
int endRight = cardView.getRight();
int endBottom = cardView.getBottom();
endRect = new Rect(endLeft, endTop, endRight, endBottom);
radius = Math.min(endWidth, endHeight)/2;
}
示例9: onSelected
import android.support.v7.widget.CardView; //導入依賴的package包/類
private boolean onSelected(CardView v) {
AppsItemViewHolder holder = (AppsItemViewHolder) v.getTag();
String packageName = holder.packageName;
if (packageName == null || !mPackages.contains(packageName)) {
return false;
}
if (mSelected.contains(packageName)) {
mSelected.remove(packageName);
} else {
mSelected.add(packageName);
}
BreventActivity activity = getActivity();
if (activity != null) {
updateIcon(holder);
activity.setSelectCount(mSelected.size());
}
return true;
}
示例10: onCreate
import android.support.v7.widget.CardView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
userId = getIntent().getIntExtra(EXTRA_USER_ID,0);
mToolbar = (Toolbar) findViewById(R.id.activity_profile_toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
mToolbar.setNavigationIcon(R.drawable.ic_action_back);
mAvatarImageView = (ImageView) findViewById(R.id.activity_profile_avatar);
mNameTextView = (TextView) findViewById(R.id.activity_profile_name);
mBioTextView = (TextView) findViewById(R.id.activity_profile_bio);
mValueTextView = (TextView) findViewById(R.id.activity_profile_value);
mLocationTextView = (TextView) findViewById(R.id.activity_profile_location);
mEditCardView = (CardView) findViewById(R.id.activity_profile_cv_edit);
mEditButton = (Button) findViewById(R.id.activity_profile_button_edit);
mRecyclerView = (RecyclerView) findViewById(R.id.activity_profile_recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setAdapter(new NewAdapter(new ArrayList<RantItem>()));
getData();
}
示例11: createCardView
import android.support.v7.widget.CardView; //導入依賴的package包/類
private void createCardView(ViewHolder holder, List<Point> points) {
for (int i = 0; i < points.size(); i++) {
final Point point = points.get(i);
View pointView = LayoutInflater.from(mContext).inflate(R.layout.carview_review, holder.ly_carview, false);
TextView pointName = (TextView) pointView.findViewById(R.id.tv_carview);
CardView cardView = (CardView) pointView.findViewById(R.id.cv_carview);
//5.0CarView 才支持設置陰影
if(Build.VERSION.SDK_INT >=21) {
cardView.setElevation(TDevice.dpToPixel(8));
}
cardViewSetBackgroundColor(point, cardView);
//如果不是無效知識點,則加入點擊事件
if (point.getObjectId() != null) {
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startContentList(point);
}
});
}
pointName.setText(point.getName());
holder.ly_carview.addView(pointView);
}
}
示例12: onClick
import android.support.v7.widget.CardView; //導入依賴的package包/類
@Override
public void onClick(View v) {
fab.setSelected(false);
removeFabMenuItems();
if (menuListener != null) {
if (v == this || v == touchGuard) {
menuListener.onMenuClosed();
} else if (v instanceof FloatingActionButton) {
menuListener.onMenuItemSelected(fabMenuItemMap.get(v));
} else if (v instanceof CardView) {
menuListener.onMenuItemSelected(cardViewMenuItemMap.get(v));
}
} else {
Log.d(TAG, "You haven't provided a MenuListener.");
}
}
示例13: CardViewHolder
import android.support.v7.widget.CardView; //導入依賴的package包/類
CardViewHolder(View view) {
super(view);
mUpFlipper = (ViewFlipper) view.findViewById(R.id.mUpFlipper);
mDownFlipper = (ViewFlipper) view.findViewById(R.id.mDownFlipper);
user_name = (TextView) view.findViewById(R.id.review_user_name);
review_date = (TextView) view.findViewById(R.id.review_date);
review_summary = (TextView) view.findViewById(R.id.review_summary);
review_up_score = (TextView) view.findViewById(R.id.review_up_score);
review_down_score = (TextView) view.findViewById(R.id.review_down_score);
review_rating = (RatingBar) view.findViewById(R.id.review_rating);
user_image = (CircleImageView) view.findViewById(R.id.review_user_image);
review_card = (CardView) view.findViewById(R.id.card_review);
review_read_more = (TextView) view.findViewById(R.id.review_read_more);
/*onClickListeners*/
user_image.setOnClickListener(this);
review_read_more.setOnClickListener(this);
review_card.setOnClickListener(this);
mUpFlipper.setOnClickListener(this);
mDownFlipper.setOnClickListener(this);
}
示例14: onCreateView
import android.support.v7.widget.CardView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View inputFragmentView = inflater.inflate(R.layout.fragment_home, container, false);
CardView greeting = (CardView) inputFragmentView.findViewById(R.id.greeting);
greeting.setOnClickListener(
new CardView.OnClickListener(){
@Override
public void onClick(View view) {
Intent i = new Intent(getContext(), GreetingActivity.class);
startActivity(i);
}
}
);
return inputFragmentView;
}
示例15: 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);
}