本文整理汇总了Java中android.support.v7.widget.CardView.setPadding方法的典型用法代码示例。如果您正苦于以下问题:Java CardView.setPadding方法的具体用法?Java CardView.setPadding怎么用?Java CardView.setPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.CardView
的用法示例。
在下文中一共展示了CardView.setPadding方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SetNewContents
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private void SetNewContents(int key) {
if (!Changes(key).equals("null")) {
CardView.LayoutParams param = new CardView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
CardView card = new CardView(this);
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("DARK_THEME_KEY", false))
card.setCardBackgroundColor(ContextCompat.getColor(this, R.color.DarkcolorPrimary));
card.setCardElevation(5);
card.setLayoutParams(param);
card.setPadding(ConvertTopx(15), ConvertTopx(15), ConvertTopx(15), ConvertTopx(15));
card.setUseCompatPadding(true);
TextView changes = new TextView(this);
changes.setGravity(Gravity.CENTER);
changes.setPadding(ConvertTopx(5), ConvertTopx(5), ConvertTopx(5), ConvertTopx(5));
changes.setText(Changes(key));
changes.setTypeface(Typeface.MONOSPACE);
if (firebaseRemoteConfig.getBoolean("mark_red") && key == 0)
changes.setTextColor(Color.RED);
card.addView(changes);
layout.addView(card);
}
bar.setVisibility(View.GONE);
}
示例2: addLinearLayout
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private CardView addLinearLayout(int layoutId, int paddingTop, int paddingBelow){
CardView l= (CardView) inflater.inflate(layoutId,null);
FrameLayout.LayoutParams p = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
l.setPadding(0,paddingTop,0,paddingBelow);
addView(l,p);
return l;
}
示例3: setAppointmentTexts
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private void setAppointmentTexts()
{
//Set the dynamic layout with appointment texts
if(fireBaseMap!=null) {
for (String s : appointmentTexts) {
//Card view of the dynamic layout
CardView cardView = new CardView(Appoinments.this);
LinearLayout.LayoutParams lp = (new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
150));
lp.setMargins(18, 20, 18, 20);
cardView.setLayoutParams(lp);
cardView.setCardBackgroundColor(0xff63D5C3);
cardView.setPadding(30, 30, 30, 30);
//Text view of the dynamic layout
TextView textView = new TextView(Appoinments.this);
LinearLayout.LayoutParams layoutParams = (new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));
textView.setLayoutParams(layoutParams);
textView.setGravity(Gravity.CENTER);
textView.setText(s);
textView.setTextColor(0xff000000); // hex color 0xAARRGGBB
textView.setTextSize(16);
textView.setTypeface(Typeface.create("monospace", Typeface.NORMAL));
//Add the text view to card view
cardView.addView(textView);
//Add the card view to linear layout
verticalLayout.addView(cardView);
}
//Set the number of appointments to a text view
String numberOfAppointments = getString(R.string.appointment) + String.valueOf(listOfAppointments.size());
appointmentTextView.setText(numberOfAppointments);
}
}