本文整理汇总了Java中android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT属性的典型用法代码示例。如果您正苦于以下问题:Java LayoutParams.WRAP_CONTENT属性的具体用法?Java LayoutParams.WRAP_CONTENT怎么用?Java LayoutParams.WRAP_CONTENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.widget.RelativeLayout.LayoutParams
的用法示例。
在下文中一共展示了LayoutParams.WRAP_CONTENT属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getView
@Override
public View getView(int position, View convertView, ViewGroup parent) {
RelativeLayout layoutView = new RelativeLayout(context);
TextView textView = new TextView(context);
textView.setTextSize(13);
textView.setText(itemList.get(position));
textView.setTag(position);
if (checkedPosition == position || itemList.size() == 1) {
// layoutView.setBackgroundColor(0x8033B5E5);
textView.setTextColor(context.getResources().getColor(R.color.rb_text_check));
} else {
textView.setTextColor(Color.WHITE);
}
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_IN_PARENT);
layoutView.addView(textView, params);
layoutView.setMinimumHeight(ParamsUtil.dpToPx(context, 26));
return layoutView;
}
示例2: onCreateDialogView
@Override
protected View onCreateDialogView() {
RelativeLayout relativeLayout = new RelativeLayout(getContext());
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
layoutParams.addRule(RelativeLayout.BELOW, 2);
LayoutParams layoutParamsText = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParamsText.addRule(RelativeLayout.ALIGN_PARENT_TOP);
layoutParamsText.addRule(RelativeLayout.CENTER_HORIZONTAL);
colorPickerView = new ColorPicker(getContext());
colorPickerView.setId(1);
currentColor = new TextView(getContext());
currentColor.setTextSize(16);
currentColor.setId(2);
relativeLayout.addView(colorPickerView, layoutParams);
relativeLayout.addView(currentColor, layoutParamsText);
return relativeLayout;
}
示例3: onCreateView
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
activity = getActivity();
context = activity.getApplicationContext();
receiver = new UploadReceiver();
activity.registerReceiver(receiver, new IntentFilter(ConfigUtil.ACTION_UPLOAD));
service = new Intent(context, UploadService.class);
binderService();
RelativeLayout view = new RelativeLayout(context);
view.setBackgroundColor(Color.WHITE);
LayoutParams uploadLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
uploadListView = new ListView(context);
uploadListView.setDivider(getResources().getDrawable(R.drawable.line));
view.addView(uploadListView, uploadLayoutParams);
uploadListView.setOnItemClickListener(onItemClickListener);
uploadListView.setOnCreateContextMenuListener(onCreateContextMenuListener);
initUploadList();
LayoutParams uploadButtonLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
uploadButtonLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
uploadButtonLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
uploadButton = new Button(context);
view.addView(uploadButton, uploadButtonLayoutParams);
uploadButton.setText("上传");
uploadButton.setTextColor(0xFFFFFFFF);
uploadButton.setOnClickListener(uploadOnClickListener);
timer.schedule(timerTask, 0, 1000);
return view;
}
示例4: getItemView
private View getItemView(Pair<String, String> pair){
RelativeLayout accountView = new RelativeLayout(context);
TextView textView = new TextView(context);
textView.setText(pair.first + " : " + pair.second);
textView.setTextSize(16);
textView.setPadding(10, 30, 0, 0);
textView.setMinHeight(ParamsUtil.dpToPx(context, 48));
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_VERTICAL);
accountView.addView(textView, params);
return accountView;
}
示例5: EditBuilder
public EditBuilder(LinearLayout layout, View view) {
super(layout, R.layout.select_entry_edit);
RelativeLayout relativeLayout = (RelativeLayout)v.findViewById(R.id.layout);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.ALIGN_LEFT, R.id.label);
layoutParams.addRule(RelativeLayout.BELOW, R.id.label);
relativeLayout.addView(view, layoutParams);
}