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


Java LayoutParams類代碼示例

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


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

示例1: onActivityResult

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	// TODO Auto-generated method stub
	super.onActivityResult(requestCode, resultCode, data);
	paoPaoQuan.setSelection(paoPaoState);
	// requestCode標示請求的標示 resultCode表示有數據
	Log.d("js", requestCode + "//" + resultCode + "**" + data);
	if (requestCode==4||data != null) {
		int childCount = imageGrid.getChildCount();
		if (childCount > 9) {
			Toast.makeText(this, "最多選擇9張圖片", 1).show();
		} else {
			imageId++;
			String fPath = null;
			if (requestCode == 4) {
				fPath = mCurrentPhotoPath;
			}else{
				Uri uri = data.getData(); // 得到Uri
				if((uri!=null&&!uri.equals(""))){
					fPath = StaticMethod.getImageAbsolutePath(this, uri); // 轉化為路徑
				}
			}
			Bitmap b = BitmapFactory.decodeFile(fPath);
			b = StaticMethod.getThumImg(b, 100);
			ImageView image = new ImageView(this);
			image.setLayoutParams(new LayoutParams(130, 130));
			image.setScaleType(ScaleType.FIT_XY);
			image.setId(imageId);
			image.setTag(fPath);
			image.setImageBitmap(b);
			image.setOnClickListener(this);
			imageGrid.addView(image, childCount - 1);
			}
	}

}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:37,代碼來源:SendPaoPaoPic.java

示例2: addNumChildView

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
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,代碼行數:25,代碼來源:NewSMSActivity.java

示例3: showAtLocation

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
@Override
  public void showAtLocation(View parent, int gravity, int x, int y) {
  	if(App.currentUser != null) {
	userId = App.currentUser.getId();
  	}
  	collect = collectDAO.getCollect(userId, mJoke.getId());
  	if(collect != null) {  //收藏過
  		getContentView().findViewById(R.id.share_collect).setSelected(true);
  	} else {
  		getContentView().findViewById(R.id.share_collect).setSelected(false);
  	}
  	Activity activity = ((Activity)context).getParent();
  	if(activity == null) {
  		activity = ((Activity)context);
  	}
  	WindowManager.LayoutParams lp = activity.getWindow().getAttributes();
lp.alpha = 0.4f;
activity.getWindow().setAttributes(lp);
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
super.showAtLocation(parent, gravity, x, y);
  }
 
開發者ID:liuling07,項目名稱:QiQuYing,代碼行數:22,代碼來源:SharePopWindow.java

示例4: a

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
public static void a(Context paramContext, SearchView paramSearchView, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
  ImageView localImageView = (ImageView)paramSearchView.findViewById(eyg.bT);
  int i1 = ((git)mbb.a(paramContext, git.class)).c();
  if (((djp)mbb.a(paramContext, djp.class)).a(i1))
  {
    localImageView.setLayoutParams(new LinearLayout.LayoutParams(0, 0));
    paramSearchView.findViewById(eyg.bU).setBackgroundResource(0);
    paramSearchView.setLayoutParams(new ActionBar.LayoutParams(-1, -2));
  }
  for (;;)
  {
    ((ImageView)paramSearchView.findViewById(eyg.bS)).setImageResource(paramInt2);
    SearchView.SearchAutoComplete localSearchAutoComplete = (SearchView.SearchAutoComplete)paramSearchView.findViewById(eyg.bV);
    Resources localResources = paramContext.getResources();
    localSearchAutoComplete.setTextColor(localResources.getColor(paramInt3));
    localSearchAutoComplete.setHintTextColor(localResources.getColor(paramInt4));
    return;
    localImageView.setImageResource(paramInt1);
  }
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:22,代碼來源:efj.java

示例5: getView

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	ViewHolder viewHolder = null;
	if(viewHolder == null)
	{
		convertView = mInflater.inflate(R.layout.item_recorder, parent, false);
		viewHolder = new ViewHolder();
		viewHolder.seconds = (TextView) convertView.findViewById(R.id.id_time);
		viewHolder.length = convertView.findViewById(R.id.id_recorder_length);
		
		convertView.setTag(viewHolder);
	}else
	{
		viewHolder = (ViewHolder) convertView.getTag();
	}
	
	viewHolder.seconds.setText(Math.round(getItem(position).getTime()) + "\"");
	ViewGroup.LayoutParams lp = viewHolder.length.getLayoutParams();
	lp.width = (int) (minItemWidth + maxItemWidth /60f * getItem(position).getTime());
	return convertView;
}
 
開發者ID:yongchao-long,項目名稱:weixin_yuyin,代碼行數:22,代碼來源:RecorderAdapter.java

示例6: show

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
public void show(Context context) {
        mActionBar = ((Activity) context).getActionBar();
        mActionBar.setDisplayShowCustomEnabled(true);  //是否可以使用自定義布局
        mActionBar.setDisplayShowHomeEnabled(false); //顯示程序圖標
        mActionBar.setDisplayShowTitleEnabled(false); //是否顯示係統的title
        mActionBar.setDisplayUseLogoEnabled(false);
        //setDisplayShowTitleEnabled和setDisplayShowHomeEnabled共同起作用
//        mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM
//                | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
        View view = LayoutInflater.from(context).inflate(R.layout.local_actionbar, null);
        mLeftTitle = (TextView) view.findViewById(R.id.left_title);
        mRightTitle = (TextView) view.findViewById(R.id.right_title);
        mMideleTitle = (TextView) view.findViewById(R.id.middle_title);
        mActionBar.setCustomView(view, new LayoutParams(LayoutParams.MATCH_PARENT,
                LayoutParams.MATCH_PARENT));
        mActionBar.show();
    }
 
開發者ID:facetome,項目名稱:Interceptor,代碼行數:18,代碼來源:LocalActionBar.java

示例7: onCreate

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	FrameLayout frame = new FrameLayout(this);
	frame.setId(CONTENT_VIEW_ID);
	setContentView(frame, new LayoutParams(LayoutParams.MATCH_PARENT,
			LayoutParams.MATCH_PARENT));

	if (savedInstanceState == null) {
		// Fragment newFragment = new DebugExampleTwoFragment();
		Fragment detailFragment = new CardsDetailFragment();
		FragmentTransaction ft = getFragmentManager().beginTransaction();
		ft.add(CONTENT_VIEW_ID, detailFragment).commit();
	}

	ActionBar actionBar = getActionBar();

	actionBar.setDisplayShowHomeEnabled(true);
	actionBar.setHomeButtonEnabled(true);
	actionBar.setDisplayHomeAsUpEnabled(true);
}
 
開發者ID:tajchert,項目名稱:CEEHack,代碼行數:22,代碼來源:ActivityDetail.java

示例8: onCreate

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	FrameLayout frame = new FrameLayout(this);
	frame.setId(CONTENT_VIEW_ID);
	setContentView(frame, new LayoutParams(LayoutParams.MATCH_PARENT,
			LayoutParams.MATCH_PARENT));

	if (savedInstanceState == null) {
		// Fragment newFragment = new DebugExampleTwoFragment();
		Fragment charFragment = new CardsPartyFragment();
		FragmentTransaction ft = getFragmentManager().beginTransaction();
		ft.add(CONTENT_VIEW_ID, charFragment).commit();
	}

	ActionBar actionBar = getActionBar();

	actionBar.setDisplayShowHomeEnabled(true);
	actionBar.setHomeButtonEnabled(true);
	actionBar.setDisplayHomeAsUpEnabled(true);
}
 
開發者ID:tajchert,項目名稱:CEEHack,代碼行數:22,代碼來源:ActivityParty.java

示例9: onResume

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
@Override
public void onResume() {
    super.onResume();
    if (tile != null) {
        ViewGroup vg = (ViewGroup)this.getActivity().findViewById(R.id.universal_frame_tile);
        //Check whether the view group is available. If so, this activity is a frame tile host 
        if (vg != null) {
            if (tile.getParent() != null) {
                ((ViewGroup)tile.getParent()).removeView(tile);
            }
            vg.addView(tile, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
            //this doesn't really make it over well
            mInternalDetailView = null;
        }
    }
}
 
開發者ID:dimagi,項目名稱:commcare-android,代碼行數:17,代碼來源:BreadcrumbBarFragment.java

示例10: onCreate

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_step_count);
	Button startBtn = (Button) this.findViewById(R.id.startRecord);
	Button endBtn = (Button) this.findViewById(R.id.endRecord);
	startBtn.setOnClickListener(listener);
	endBtn.setOnClickListener(listener);
	mStepValue = 0;
	isServiceRunning = false;
	
	LinearLayout linearView=(LinearLayout)findViewById(R.id.chart);
	linearView.setVisibility(View.GONE);
	sensorChart = new SensorChart();
	mChartStatus = MENU_MAP;
	//chartView = sensorChart.getDemoChartGraphicalView(this);
       
       //linearView.addView(chartView,
       //        new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
	LinearLayout mapLinearView=(LinearLayout)findViewById(R.id.mapchart);
	mapLinearView.setVisibility(View.VISIBLE);
	glView = new MapChart(this);
	mapLinearView.addView(glView,
					   new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
}
 
開發者ID:yzxsunshine,項目名稱:SensorFusionPedometer,代碼行數:26,代碼來源:PedometerStepCounter.java

示例11: onCreateOptionsMenu

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
@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,代碼行數:25,代碼來源:MainTimeLineActivity.java

示例12: onActivityResult

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
@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,代碼行數:26,代碼來源:ImportPhoto.java

示例13: showPopup

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
public static void showPopup(final Context c, final Pharmacy a) {
    Dialog d = new Dialog(c);
    d.setContentView(R.layout.popup_layout);
    d.setTitle(a.getName());
    ((TextView) d.findViewById(R.id.apo_name)).setText(c.getString(R.string.name) + ": " + a.getName());
    ((TextView) d.findViewById(R.id.apo_address)).setText(c.getString(R.string.address) + ": " + a.getAddress());
    ((TextView) d.findViewById(R.id.apo_zipcode)).setText(c.getString(R.string.zipcode) + ": " + a.getZipcode());
    ((TextView) d.findViewById(R.id.apo_town)).setText(c.getString(R.string.town) + ": " + a.getTown());
    if (!a.getTelnr().isEmpty()) {
        LinearLayout ll = (LinearLayout) d.findViewById(R.id.layout);
        TextView tel = new TextView(c);
        tel.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1));
        tel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
        tel.setText(c.getString(R.string.tel) + ": " + a.getTelnr());
        Linkify.addLinks(tel, Pattern.compile("\\+?(\\d){8,11}"), "tel:");
        ll.addView(tel);
    }
    d.show();
}
 
開發者ID:wpinnoo,項目名稱:PharmaApp,代碼行數:20,代碼來源:InfoPopup.java

示例14: setActionBarOptions

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
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,代碼行數:17,代碼來源:TestListActivity.java

示例15: onStart

import android.app.ActionBar.LayoutParams; //導入依賴的package包/類
@Override
public void onStart() {
    super.onStart();
    final Dialog dialog = getDialog();
    if (dialog != null) {
        final Window windowDialog = dialog.getWindow();
        if (windowDialog != null) {
            if (Utils.isLandscape(getActivity())) {
                final int width = ViewGroup.LayoutParams.MATCH_PARENT;
                final int height = ViewGroup.LayoutParams.MATCH_PARENT;
                windowDialog.setLayout(width, height);
            }
        }
    }
}
 
開發者ID:ttpho,項目名稱:TimePicker,代碼行數:16,代碼來源:TimePickerDialog.java


注:本文中的android.app.ActionBar.LayoutParams類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。