本文整理汇总了Java中cn.smssdk.gui.layout.SizeHelper.prepare方法的典型用法代码示例。如果您正苦于以下问题:Java SizeHelper.prepare方法的具体用法?Java SizeHelper.prepare怎么用?Java SizeHelper.prepare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.smssdk.gui.layout.SizeHelper
的用法示例。
在下文中一共展示了SizeHelper.prepare方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initScroll
import cn.smssdk.gui.layout.SizeHelper; //导入方法依赖的package包/类
private void initScroll(Context context) {
llScroll.removeAllViews();
SizeHelper.prepare(context);
int size = adapter.getGroupCount();
int dp3 = SizeHelper.fromPxWidth(6);
int dp2 = SizeHelper.fromPxWidth(4);
for (int i = 0; i < size; i++) {
TextView tv = new TextView(context);
tv.setText(adapter.getGroupTitle(i));
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, SizeHelper.fromPxWidth(18));
tv.setGravity(Gravity.CENTER);
tv.setPadding(dp3, dp2, dp3, dp2);
llScroll.addView(tv);
}
}
示例2: initScroll
import cn.smssdk.gui.layout.SizeHelper; //导入方法依赖的package包/类
private void initScroll(Context context) {
llScroll.removeAllViews();
SizeHelper.prepare(context);
int size = adapter.getGroupCount();
int dp_3 = SizeHelper.fromPxWidth(6);
int dp_2 = SizeHelper.fromPxWidth(4);
for (int i = 0; i < size; i++) {
TextView tv = new TextView(context);
tv.setText(adapter.getGroupTitle(i));
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, SizeHelper.fromPxWidth(18));
tv.setGravity(Gravity.CENTER);
tv.setPadding(dp_3, dp_2, dp_3, dp_2);
llScroll.addView(tv);
}
}
示例3: getTitleView
import cn.smssdk.gui.layout.SizeHelper; //导入方法依赖的package包/类
public TextView getTitleView(int group, TextView convertView, ViewGroup parent) {
if (convertView == null) {
SizeHelper.prepare(parent.getContext());
convertView = new TextView(parent.getContext());
convertView.setBackgroundColor(0xffeae8ee);
convertView.setTextSize(TypedValue.COMPLEX_UNIT_PX, SizeHelper.fromPxWidth(25));
convertView.setTextColor(0xff999999);
int padding = SizeHelper.fromPxWidth(18);
convertView.setPadding(padding, 0, 0, 0);
convertView.setWidth(LayoutParams.MATCH_PARENT);
int height = SizeHelper.fromPxWidth(40);
convertView.setHeight(height);
convertView.setGravity(Gravity.CENTER_VERTICAL);
}
String title = getGroupTitle(group);
if (!TextUtils.isEmpty(title)) {
convertView.setText(title);
}
return convertView;
}
示例4: init
import cn.smssdk.gui.layout.SizeHelper; //导入方法依赖的package包/类
private void init(Context context) {
SizeHelper.prepare(context);
lvContries = new GroupListView(context);
lvContries.setDividerHeight(SizeHelper.fromPxWidth(1));
int resId = ResHelper.getBitmapRes(context, "smssdk_cl_divider");
if (resId > 0) {
lvContries.setDivider(context.getResources().getDrawable(resId));
}
adapter = new CountryAdapter(lvContries);
lvContries.setAdapter(adapter);
LayoutParams lpContries = new LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
int dp9 = SizeHelper.fromPxWidth(12);
lpContries.setMargins(dp9, 0, dp9, 0);
addView(lvContries, lpContries);
tvScroll = new TextView(context);
resId = ResHelper.getColorRes(context, "smssdk_white");
if (resId > 0) {
tvScroll.setTextColor(context.getResources().getColor(resId));
}
resId = ResHelper.getBitmapRes(context, "smssdk_country_group_scroll_down");
if (resId > 0) {
tvScroll.setBackgroundResource(resId);
}
tvScroll.setTextSize(TypedValue.COMPLEX_UNIT_PX, SizeHelper.fromPxWidth(80));
tvScroll.setTypeface(Typeface.DEFAULT);
tvScroll.setVisibility(GONE);
tvScroll.setGravity(Gravity.CENTER);
int dp80 = SizeHelper.fromPxWidth(120);
LayoutParams lp = new LayoutParams(dp80, dp80);
lp.addRule(CENTER_IN_PARENT);
addView(tvScroll, lp);
llScroll = new LinearLayout(context);
resId = ResHelper.getBitmapRes(context, "smssdk_country_group_scroll_up");
if (resId > 0) {
llScroll.setBackgroundResource(resId);
}
llScroll.setOrientation(LinearLayout.VERTICAL);
llScroll.setOnTouchListener(this);
lp = new LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.addRule(ALIGN_PARENT_RIGHT);
lp.addRule(CENTER_VERTICAL);
lp.rightMargin = SizeHelper.fromPxWidth(7);
addView(llScroll, lp);
initScroll(context);
}
示例5: init
import cn.smssdk.gui.layout.SizeHelper; //导入方法依赖的package包/类
private void init(Context context) {
SizeHelper.prepare(context);
lvContries = new GroupListView(context);
lvContries.setDividerHeight(SizeHelper.fromPxWidth(1));
int resId = getBitmapRes(context, "smssdk_cl_divider");
if (resId > 0) {
lvContries.setDivider(context.getResources().getDrawable(resId));
}
adapter = new CountryAdapter(lvContries);
lvContries.setAdapter(adapter);
LayoutParams lpContries = new LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
int dp_9 = SizeHelper.fromPxWidth(12);
lpContries.setMargins(dp_9, 0, dp_9, 0);
addView(lvContries, lpContries);
tvScroll = new TextView(context);
resId = getColorRes(context, "smssdk_white");
if (resId > 0) {
tvScroll.setTextColor(context.getResources().getColor(resId));
}
resId = getBitmapRes(context, "smssdk_country_group_scroll_down");
if (resId > 0) {
tvScroll.setBackgroundResource(resId);
}
tvScroll.setTextSize(TypedValue.COMPLEX_UNIT_PX, SizeHelper.fromPxWidth(80));
tvScroll.setTypeface(Typeface.DEFAULT);
tvScroll.setVisibility(GONE);
tvScroll.setGravity(Gravity.CENTER);
int dp_80 = SizeHelper.fromPxWidth(120);
LayoutParams lp = new LayoutParams(dp_80, dp_80);
lp.addRule(CENTER_IN_PARENT);
addView(tvScroll, lp);
llScroll = new LinearLayout(context);
resId = getBitmapRes(context, "smssdk_country_group_scroll_up");
if (resId > 0) {
llScroll.setBackgroundResource(resId);
}
llScroll.setOrientation(LinearLayout.VERTICAL);
llScroll.setOnTouchListener(this);
lp = new LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.addRule(ALIGN_PARENT_RIGHT);
lp.addRule(CENTER_VERTICAL);
lp.rightMargin = SizeHelper.fromPxWidth(7);
addView(llScroll, lp);
initScroll(context);
}