当前位置: 首页>>代码示例>>Java>>正文


Java LayoutParams.WRAP_CONTENT属性代码示例

本文整理汇总了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;

		}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:24,代码来源:PopMenu.java

示例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;

}
 
开发者ID:89luca89,项目名称:ThunderMusic,代码行数:26,代码来源:ColorPickerPreference.java

示例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;
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:35,代码来源:UploadFragment.java

示例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;
	
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:14,代码来源:AccountViewAdapter.java

示例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);
}
 
开发者ID:tiberiusteng,项目名称:financisto1-holo,代码行数:8,代码来源:NodeInflater.java


注:本文中的android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。