當前位置: 首頁>>代碼示例>>Java>>正文


Java LayoutParams.MATCH_PARENT屬性代碼示例

本文整理匯總了Java中android.app.ActionBar.LayoutParams.MATCH_PARENT屬性的典型用法代碼示例。如果您正苦於以下問題:Java LayoutParams.MATCH_PARENT屬性的具體用法?Java LayoutParams.MATCH_PARENT怎麽用?Java LayoutParams.MATCH_PARENT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.app.ActionBar.LayoutParams的用法示例。


在下文中一共展示了LayoutParams.MATCH_PARENT屬性的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateOptionsMenu

@Override
public boolean onCreateOptionsMenu(Menu menu) {

	// Inflate the menu; this adds items to the action bar if it is present.
	// getMenuInflater().inflate(null, menu);
	ActionBar actionBar = getActionBar();
	actionBarHeight = actionBar.getHeight();
	ActionBar.LayoutParams params = new ActionBar.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,
			Gravity.CENTER);
	View view = LayoutInflater.from(this)
			.inflate(R.layout.main_title, null);
	actionBar.setCustomView(view, params);
	actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
	actionBar.setDisplayShowCustomEnabled(true);

	ivTitleBtnRight = (ImageButton) this.findViewById(R.id.ivTitleBtnRight);
	ivTitleBtnLeft = (ImageButton) this.findViewById(R.id.ivTitleBtnLeft);
	titleText = (TextView) this.findViewById(R.id.ivTitleName);
	ivTitleBtnLeft.setOnClickListener(this);
	ivTitleBtnRight.setOnClickListener(this);

	return true;
}
 
開發者ID:misty-rain,項目名稱:smartedu,代碼行數:24,代碼來源:MainTimeLineActivity.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: 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

示例4: showProgress

private void showProgress(){
	ProgressBar progressBar=new ProgressBar(MainActivity.this,null,
			android.R.attr.progressBarStyleLargeInverse);
	progressBar.setMax(1000);
	RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
	progressBar.setLayoutParams(params);
	layout.addView(progressBar);

}
 
開發者ID:liudabao,項目名稱:DialogDemo,代碼行數:9,代碼來源:MainActivity.java

示例5: 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

示例6: renderLayout

public LinearLayout renderLayout(TableLayout table, TableLayout cbs) {
 
 //prepare
 LinearLayout rtn = new LinearLayout(this);
 rtn.setOrientation(LinearLayout.VERTICAL);
 ScrollView v = new ScrollView(this);
 v.addView(table);
 TextView cbLabel = new TextView(this);
 cbLabel.setText("\n\nSelect Access Points to keep: ");
 ScrollView v2 = new ScrollView(this);
 v2.addView(cbs);
 
 //add
 LinearLayout.LayoutParams param1 = new LinearLayout.LayoutParams(
               LayoutParams.MATCH_PARENT,
               0, 0.5f);
 v.setLayoutParams(param1);
 rtn.addView(v);		   
 LinearLayout.LayoutParams param2 = new LinearLayout.LayoutParams(
               LayoutParams.MATCH_PARENT,
               0, 0.1f);		   
 cbLabel.setLayoutParams(param2);
 rtn.addView(cbLabel);
 LinearLayout.LayoutParams param3 = new LinearLayout.LayoutParams(
               LayoutParams.MATCH_PARENT,
               0, 0.3f);		   
 v2.setLayoutParams(param3);
 rtn.addView(v2);
 LinearLayout.LayoutParams param4 = new LinearLayout.LayoutParams(
               LayoutParams.MATCH_PARENT,
               0, 0.1f);		   		   
 buildButton.setLayoutParams(param4);
 rtn.addView(buildButton);
 return rtn;
}
 
開發者ID:prateekt,項目名稱:WifiLocLib,代碼行數:35,代碼來源:ModelBuildingActivity.java

示例7: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.fragment_main);
	showLoadingDialog();
	manufature = 1;
	language = 0;
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayShowCustomEnabled(true);

	LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT,
			LayoutParams.MATCH_PARENT);
	navigation = LayoutInflater.from(this).inflate(R.layout.option_menu,
			null);
	actionBar.setCustomView(navigation, lp);

	optv1 = (TextView) navigation.findViewById(R.id.op_tv1);
	optv2 = (TextView) navigation.findViewById(R.id.op_tv2);
	op_tv3 = (TextView) navigation.findViewById(R.id.op_tv3);
	langImg = (ImageView) navigation.findViewById(R.id.language);
	langImg.setOnClickListener(this);
	optv1.setOnClickListener(this);
	optv2.setOnClickListener(this);
	op_tv3.setOnClickListener(this);
	mListView = (ListView) findViewById(R.id.listview);
	atm = AsyncTaskManager.getInstance(this);
	getData.start();

	mSongs = new ArrayList<ArrayList<Song>>();

}
 
開發者ID:lengocduy,項目名稱:testApp1_android,代碼行數:31,代碼來源:DKaraoke.java

示例8: initPopupMenuBg

private void initPopupMenuBg(final Activity context) {
	LayoutInflater inflater = LayoutInflater.from(context);
	View view = inflater.inflate(R.layout.defaultpopupmenubg, null);
	mPopupMenuBg = new PopupWindow(view, LayoutParams.MATCH_PARENT,
			LayoutParams.MATCH_PARENT, false);
	mPopupMenuBg.setFocusable(false);
	mPopupMenuBg.setOutsideTouchable(false);
	mPopupMenuBg.setBackgroundDrawable(null);
	mPopupMenuBg.setAnimationStyle(R.style.default_popup_menu_bg_style);
	mPopupMenuBg.update();
}
 
開發者ID:liyinyin,項目名稱:fullscreen-popupmenu,代碼行數:11,代碼來源:FullScreenPopupMenu.java

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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.MATCH_PARENT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。