當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。