本文整理匯總了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);
}