本文整理匯總了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;
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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>>();
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}