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


Java LayoutParams.WRAP_CONTENT属性代码示例

本文整理汇总了Java中android.app.ActionBar.LayoutParams.WRAP_CONTENT属性的典型用法代码示例。如果您正苦于以下问题:Java LayoutParams.WRAP_CONTENT属性的具体用法?Java LayoutParams.WRAP_CONTENT怎么用?Java LayoutParams.WRAP_CONTENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.app.ActionBar.LayoutParams的用法示例。


在下文中一共展示了LayoutParams.WRAP_CONTENT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addNumChildView

public void addNumChildView(String aName, String aNumber) {
	positon++;
	tv_men = new TextView(NewSMSActivity.this);
	tv_men.setText(aName.trim());
	LayoutParams tvLay = new LayoutParams(LayoutParams.WRAP_CONTENT,
			LayoutParams.WRAP_CONTENT);
	tvLay.setMargins(5, 5, 5, 5);
	tv_men.setPadding(3, 3, 3, 3);
	tv_men.setLayoutParams(tvLay);
	tv_men.setBackgroundColor(Color.BLUE);
	tv_men.setTextColor(Color.GRAY);
	tv_men.setTextSize(12);
	tv_men.setTextAppearance(NewSMSActivity.this, R.style.textview_number);
	tv_men.setId(positon);
	tv_men.setTag(Boolean.valueOf(false));
	tv_men.setOnClickListener(NewSMSActivity.this);

	menMap.put(String.valueOf(tv_men.getId()), tv_men);
	flowLayout.addView(tv_men, flowLayout.getChildCount() - 1);
	ContactMen contactMen = new ContactMen();
	contactMen.setName(aName.trim());
	contactMen.setNumber(aNumber.trim());
	smsSendMen.put(String.valueOf(tv_men.getId()), contactMen);
}
 
开发者ID:liang10607,项目名称:ContactList,代码行数:24,代码来源:NewSMSActivity.java

示例2: onActivityResult

@SuppressLint("NewApi")
protected void onActivityResult(int requestCode, int resultCode,
		Intent imageReturnedIntent) {
	super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
	switch (requestCode) {
	case SELECT_PHOTO:
		if (resultCode == RESULT_OK) {
			Uri selectedImage = imageReturnedIntent.getData();
			String[] filePathColumn = { MediaStore.Images.Media.DATA };
			Cursor cursor = getContentResolver().query(selectedImage,
					filePathColumn, null, null, null);
			cursor.moveToFirst();
			int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
			url = cursor.getString(columnIndex);
			cursor.close();
			ImageView imView = new ImageView(this);
			LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
			imView.setLayoutParams(lp);
			Bitmap bm = BitmapFactory.decodeFile(url);
			imView.setImageBitmap(bm);
			LinearLayout ll = (LinearLayout) findViewById(R.id.image_container);
			ll.addView(imView);
		}
	}
}
 
开发者ID:Malatawy15,项目名称:BagOfPix,代码行数:25,代码来源:ImportPhoto.java

示例3: setActionBarOptions

private void setActionBarOptions() {
    View v = getLayoutInflater().inflate(R.layout.test_list_options, null);

    SharedPreferences sp = getSharedPreferences(PREFS, MODE_PRIVATE);
    CheckBox cb = (CheckBox) v.findViewById(R.id.single_mode);
    cb.setChecked(sp.getBoolean(KEY_SINGLE_MODE, false));
    cb.setOnCheckedChangeListener(this);

    LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.RIGHT | Gravity.CENTER_VERTICAL;
    getActionBar().setCustomView(v, lp);

    int flags = ActionBar.DISPLAY_SHOW_CUSTOM;
    int options = getActionBar().getDisplayOptions() ^ flags;
    getActionBar().setDisplayOptions(options, flags);
}
 
开发者ID:doctang,项目名称:android-basic-test,代码行数:16,代码来源:TestListActivity.java

示例4: popUpCalendarView

private void popUpCalendarView()
{
	if (calendarPopup == null)
	{
		LayoutInflater inflater = LayoutInflater.from(this);
		calendarPopupView = inflater.inflate(R.layout.calendar_layout, null);
		calendarPopup = new PopupWindow(calendarPopupView, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, true);
		calendarPopup.setFocusable(true);
		calendarPopup.setBackgroundDrawable(new BitmapDrawable());
		calendar_month_text = (TextView) calendarPopupView.findViewById(R.id.calendar_month_text);
		calendar_year_text = (TextView) calendarPopupView.findViewById(R.id.calendar_year_text);
		calendar_close_btn = (LinearLayout) calendarPopupView.findViewById(R.id.calendar_close_btn);
		calendar_all_time_btn = (LinearLayout) calendarPopupView.findViewById(R.id.calendar_all_time_btn);
		calendar_arrow_left = (ImageView) calendarPopupView.findViewById(R.id.calendar_arrow_left);
		calendar_arrow_right = (ImageView) calendarPopupView.findViewById(R.id.calendar_arrow_right);
		calendar_view = (CalendarView) calendarPopupView.findViewById(R.id.calendar_view);
		calendar_view.setOnItemClickListener(this);

		calendar_arrow_left.setOnClickListener(this);
		calendar_arrow_right.setOnClickListener(this);
		calendar_close_btn.setOnClickListener(this);
		calendar_all_time_btn.setOnClickListener(this);
		if(android.os.Build.VERSION.SDK_INT >= 19 ){
			if(CommUtil.checkDeviceHasNavigationBar(this)){
				y = CommUtil.getNavigationBarHeight(this);
			}
		}

	}
	if (date_click == null)
	{
		Calendar date = Calendar.getInstance();
		calendar_year_text.setText("" + date.get(Calendar.YEAR));
		calendar_month_text.setText("" + month_name[date.get(Calendar.MONTH)]);
	}
	calendarPopup.showAtLocation(this.findViewById(R.id.videolist_root), Gravity.BOTTOM, 0, y);
}
 
开发者ID:OpenIchano,项目名称:Viewer,代码行数:37,代码来源:AtHomeCameraVideolistNaoCan.java

示例5: setCustomActionBarView

private void setCustomActionBarView() {
	ActionBar.LayoutParams lp = new ActionBar.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
			Gravity.CENTER);
	View actionBarView = getLayoutInflater().inflate(
			R.layout.activity_login, null);
	getActionBar().setCustomView(actionBarView, lp);
	getActionBar().setDisplayShowHomeEnabled(false);
	getActionBar().setDisplayShowTitleEnabled(false);
	getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
	getActionBar().setDisplayShowCustomEnabled(true);
}
 
开发者ID:cqtddt,项目名称:AndroidPAD,代码行数:12,代码来源:MainActivity.java

示例6: attachBreadcrumbBar

private void attachBreadcrumbBar(Activity activity, ActionBar actionBar) {
    //make sure we're in the right mode
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);

    //We need to get the amount that each item should "bleed" over to the left, and move the whole widget that
    //many pixels. This replicates the "overlap" space that each piece of the bar has on the next piece for
    //the left-most element.
    int buffer = Math.round(activity.getResources().getDimension(R.dimen.title_round_bleed));
    LayoutParams p = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
    p.leftMargin = buffer;

    activity.setTitle("");
    actionBar.setDisplayShowHomeEnabled(false);
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:15,代码来源:BreadcrumbBarFragment.java

示例7: onCreateView

@Override
public View onCreateView(LayoutInflater inflater,
		@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

	_view = new RelativeLayout(getActivity());
	_view.setBackgroundColor(Color.GRAY);
	ImageView imageView = new ImageView(getActivity());
	imageView.setImageResource(R.drawable.ic_launcher);
	FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	params.gravity = Gravity.CENTER;
	imageView.setLayoutParams(params);
	_view.addView(imageView);
	return _view;
}
 
开发者ID:joaogithub,项目名称:Testes,代码行数:14,代码来源:ImageFragment.java

示例8: initConvenientView

/**
 * 初始化快捷菜单
 */
private void initConvenientView() {
/*	PathView mPathView = (PathView) this
			.findViewById(R.id.mPathView_uitilsmodem);
	ImageButton startMenu = new ImageButton(MainTimeLineActivity.this);
	startMenu.setBackgroundResource(R.drawable.start_menu_btn);
	mPathView.setStartMenu(startMenu);
	
	mPathView.setItems(new View[0]);
	mPathView.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			Intent intent = new Intent(MainTimeLineActivity.this, WriteWeiboActivity.class);
               intent.putExtra("token", getToken());
               intent.putExtra("account", getAccount());
               startActivity(intent);
			
		}
	});*/
 floatView=new FloatView(getApplicationContext());
 floatView.setImageResource(R.drawable.white_weibo_menuitem_button);
 windowManager=(WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
 windowManagerParams=((GlobalContext)getApplication()).getWindowParams();
 windowManagerParams.type=android.view.WindowManager.LayoutParams.TYPE_PHONE;
    windowManagerParams.format = PixelFormat.RGBA_8888; 
    windowManagerParams.flags = android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL 
    | android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; 
    windowManagerParams.gravity = Gravity.CENTER_VERTICAL | Gravity.BOTTOM; 
    windowManagerParams.x = 0; 
    windowManagerParams.y = 0; 
    windowManagerParams.width = LayoutParams.WRAP_CONTENT; 
    windowManagerParams.height = LayoutParams.WRAP_CONTENT; 
    windowManager.addView(floatView, windowManagerParams);
 
	
	
}
 
开发者ID:misty-rain,项目名称:smartedu,代码行数:41,代码来源:MainTimeLineActivity.java

示例9: setupButtonViews

void setupButtonViews(Context context) {
	mButtonView = (Button) getInflater().inflate(R.layout.accessory_button, null);
	mButtonView.setClickable(true);
	int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, 
			context.getResources().getDisplayMetrics());
	LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, height);
	getAccessoryView().removeAllViews();
	getAccessoryView().addView(mButtonView, params);
}
 
开发者ID:manhthiep,项目名称:android-mimic-ui,代码行数:9,代码来源:UIButtonItem.java

示例10: onCreate

@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_view_story);
	Intent intent = getIntent();
	int storyId = Integer.parseInt(intent.getStringExtra("storyId"));
	db = new DBHandler();
	story = db.get_story(storyId);
	TextView textView = (TextView) findViewById(R.id.story_name_view);
	textView.setText(story.getName());
	LinearLayout ll = (LinearLayout) findViewById(R.id.view_story_scroll);
	ArrayList<Photo> photos = db.get_photos(storyId);
	for (int i = 0; i < photos.size(); i++) {
		LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
		lp.setMargins(10,10,10,10);
		
		ImageView imView = new ImageView(this);
		String imgUrl = photos.get(i).getUrl();
		Bitmap bm = BitmapFactory.decodeFile(imgUrl);
		imView.setImageBitmap(bm);
		imView.setLayoutParams(lp);
		ll.addView(imView);
		TextView tView = new TextView(this);
		String imgComment = photos.get(i).getComment();
		tView.setText(imgComment);
		tView.setGravity(Gravity.CENTER);
		tView.setLayoutParams(lp);
		ll.addView(tView);
	}
	Button share = (Button) findViewById(R.id.share);
	share.setOnClickListener(shareListener);
}
 
开发者ID:Malatawy15,项目名称:BagOfPix,代码行数:33,代码来源:ViewStory.java

示例11: updateBaseInfo

protected void updateBaseInfo(boolean animate) {
    boolean opened = getPreferences().getBoolean(PREF_SHOW_BASEINFO + getClass().getSimpleName(), true);

    descriptions.getLayoutParams().height = LayoutParams.WRAP_CONTENT;

    if (opened) {
        openDescription(null, animate);
    } else {
        closeDescription(animate);
    }
}
 
开发者ID:gandulf,项目名称:DsaTab,代码行数:11,代码来源:BaseProfileFragment.java

示例12: addMoreEditText

public AutoCompleteTextView addMoreEditText(String hint) {

		final AutoCompleteTextView editText = new AutoCompleteTextView(
				getActivity());

		LinearLayout.LayoutParams editTextLayoutParams = new LinearLayout.LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
		// if (hint.equalsIgnoreCase("Qualification")) {
		// editText.setId(educationid);
		// editText.setCompoundDrawablesWithIntrinsicBounds(
		// R.drawable.education, 0, 0, 0);
		// educationMoreEditText.add(editText);
		// educationid++;
		// editText.setHint(hint + " " + educationid);
		// } else if (hint.equalsIgnoreCase("Certification")) {
		// editText.setId(certificationId);
		// editText.setCompoundDrawablesWithIntrinsicBounds(
		// R.drawable.certificate, 0, 0, 0);
		// certificateMoreEditText.add(editText);
		// certificationId++;
		// editText.setHint(hint + " " + certificationId);
		// } else ...

		if (hint.equalsIgnoreCase("Skills")) {
			editText.setId(skillID);
			editText.setCompoundDrawablesWithIntrinsicBounds(R.drawable.skills,
					0, 0, 0);
			skillsMoreEditText.add(editText);
			skillID++;
			editText.setHint(hint + " " + (skillID + 2));
			// editTextLayoutParams = new
			// LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
			// LayoutParams.WRAP_CONTENT);

			skillsAdapter = new ArrayAdapter<String>(getActivity(),
					android.R.layout.simple_list_item_1, getSkills());
			editText.setAdapter(skillsAdapter);
			editText.setThreshold(1);
			editText.setOnItemClickListener(new OnItemClickListener() {

				@Override
				public void onItemClick(AdapterView<?> parent, View view,
						int position, long id) {
					addSkillId(editText.getText().toString());
				}

			});
		} else if (hint.equalsIgnoreCase("Working Hours")) {
			editText.setId(skillWorkHrID);
			editText.setCompoundDrawablesWithIntrinsicBounds(
					R.drawable.working_hours, 0, 0, 0);
			skillsWorkHrMoreEditText.add(editText);
			skillWorkHrID++;
			editText.setHint(hint);
			editText.setInputType(InputType.TYPE_CLASS_DATETIME);
			// editTextLayoutParams = new
			// LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
			// LayoutParams.WRAP_CONTENT);
		}

		// editTextLayoutParams.setMargins(10, 10, 10, 10);
		editText.setCompoundDrawablePadding(10);
		editText.setLayoutParams(editTextLayoutParams);

		return editText;
	}
 
开发者ID:himanshuagarwal77225,项目名称:BookMySkills,代码行数:66,代码来源:RegisterFragment.java

示例13: getView

@Override
public View getView(int position, View convertView, ViewGroup parent) {
	ViewHolder holder;
	int nextID = 3;

	if (convertView == null)
	{
		convertView = View.inflate(context, R.layout.robot_card, null);
		holder = new ViewHolder();

		Robot robot = mRobotList.get(position);

		LinearLayout ll = (LinearLayout) convertView
				.findViewById(R.id.scrollLinearLayout);
		LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

		holder.name = new TextView(this.context);
		holder.name.setId(nextID);
		nextID++;
		holder.name.setTextSize(50);
		holder.name.setText(robot.getName());
		holder.name.setLayoutParams(lp);
		holder.name.setGravity(Gravity.CENTER);
		ll.addView(holder.name);

		holder.infoTextView = new TextView(this.context);
		holder.infoTextView.setId(nextID);
		holder.infoTextView.setTextSize(24);
		holder.infoTextView.setText(robot.getInfo());
		holder.infoTextView.setLayoutParams(lp);
		holder.infoTextView.setGravity(Gravity.LEFT);
		holder.infoTextView.setPadding(30, 10, 30, 10);
		holder.infoTextView.setTextColor(context.getResources().getColor(R.color.blue));
		ll.addView(holder.infoTextView);
		
		holder.prevTxt = (TextView) convertView.findViewById(R.id.robotPreviousText);
		holder.nextTxt = (TextView) convertView.findViewById(R.id.robotNextText);
		holder.robotCounter = (TextView) convertView.findViewById(R.id.robotCounterText);
		
		convertView.setTag(holder);
	} else 
	{
		holder = (ViewHolder) convertView.getTag();
	}
	
	if (hasNext(position))
       {
       	holder.nextTxt.setVisibility(View.VISIBLE);
       	holder.nextTxt.setText(R.string.next);
       }
       else
       {
       	holder.nextTxt.setVisibility(View.INVISIBLE);
       	//holder.nextTxt.setText(R.string.no_next);
       }
       
       if (hasPrevious(position))
       {
       	holder.prevTxt.setVisibility(View.VISIBLE);
       	holder.prevTxt.setText(R.string.previous);
       }
       else
       {
       	holder.prevTxt.setVisibility(View.INVISIBLE);
       	//holder.prevTxt.setText(R.string.no_previous);
       }
       
       holder.robotCounter.setText((position + 1) + " of " + mRobotList.size());

	return convertView;
}
 
开发者ID:RIVeR-Lab,项目名称:google_glass_driver,代码行数:72,代码来源:RobotCardScrollAdapter.java

示例14: onServiceConnected

@Override
public void onServiceConnected(final ComponentName name, final IBinder service) {
	mService = IInAppBillingService.Stub.asInterface(service);
	// Create Async task
	asyncTask = new SimpleAsyncTask() {

		/**
		 * response list
		 */
		private ArrayList<String> responseList;

		@Override
		protected void onPreExecute() {
			if (layout != null) {
				layout.removeAllViews();
			}
		}

		@Override
		protected void doInBackground() {
			Bundle querySkus = new Bundle();
			ArrayList<String> itemId = new ArrayList<String>();
			for (int i = 0; i < 5; i++) {
				itemId.add("donate_" + i);
			}
			try {
				// Get owned Items
				Bundle ownedItems = mService.getPurchases(3, getActivity().getPackageName(), INAPP, null);
				if (ownedItems.getInt(RESPONSE_CODE) == BILLING_RESPONSE_RESULT_OK) {
					final ArrayList<String> owned = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");
					if (CollectionUtils.isNotEmpty(owned)) {
						itemId.removeAll(owned);
					}
				}
				querySkus.putStringArrayList("ITEM_ID_LIST", itemId);
				// get Sku detail
				Bundle skuDetails = mService.getSkuDetails(3, getActivity().getPackageName(), INAPP, querySkus);
				if (skuDetails.getInt(RESPONSE_CODE) == BILLING_RESPONSE_RESULT_OK) {
					responseList = skuDetails.getStringArrayList(DETAILS_LIST);
				}

			} catch (RemoteException e) {
				Log.e(BillingFragment.class.getName(), "Remote exception", e);
			}

		}

		@Override
		protected void onPostExecute(final Object result) {
			if (responseList != null) {
				for (String thisResponse : responseList) {
					try {
						SkuDetails sku = new SkuDetails(thisResponse);
						View v = View.inflate(getActivity(), R.layout.inapp_listview_item, null);
						v.setOnClickListener(BillingFragment.this);
						v.setTag(sku);
						// Add layout param
						LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
								LayoutParams.WRAP_CONTENT);
						params.setMargins(0, 10, 0, 0);
						v.setLayoutParams(params);
						// Add inApp text
						TextView text = (TextView) v.findViewById(R.id.inapp_text);
						text.setText(sku.getDescription().trim() + " " + sku.getPrice());
						// Add view
						layout.addView(v);
					} catch (JSONException e) {
						Log.e(BillingFragment.class.getName(), "Billing response error", e);
					}
				}
			}
		}
	};
	asyncTask.execute();
}
 
开发者ID:devnied,项目名称:EMV-NFC-Paycard-Enrollment,代码行数:75,代码来源:BillingFragment.java

示例15: onCreateView

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	Log.i(TAG, "MapFragment, onCreateView()");
	
	RelativeLayout mapLayout = new RelativeLayout(getActivity());
	mapLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT));
	// load webmap
	mapView = new MapView(getActivity(), webMapUrl, null, null);
	RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	mapLayout.addView(mapView, params);
	
	final ImageButton gpsButton = new ImageButton(getActivity());
	gpsButton.setImageResource(R.drawable.ic_location_off);
	RelativeLayout.LayoutParams gpsParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	gpsParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	gpsParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
	gpsButton.setOnClickListener(new OnClickListener() {
		public void onClick(View v) {
			if(showingGpsPosition){
				locationDisplayManager.stop();
				gpsButton.setImageResource(R.drawable.ic_location_off);
				showingGpsPosition = false;
			}else{
				locationDisplayManager = mapView.getLocationDisplayManager();
				locationDisplayManager.setAutoPanMode(AutoPanMode.LOCATION);
				locationDisplayManager.start();
				gpsButton.setImageResource(R.drawable.ic_location_on);
				showingGpsPosition = true;
			}
		}
	});
	mapLayout.addView(gpsButton, gpsParams);
	
    if (savedInstanceState != null) {
        mapState = savedInstanceState.getString(MAP_STATE);
    }	
	if (mapState != null) {
		mapView.restoreState(mapState);
	}
	
	return mapLayout;
}
 
开发者ID:EsriDE,项目名称:PTM-OSMGeotrigger,代码行数:42,代码来源:MapFragment.java


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