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