731

public boolean onContextItemSelected(MenuItem item) {
		AdapterView.AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) item
				.getMenuInfo();
		int id = menuInfo.position;
		switch (item.getItemId()) {
		case 1:
			list.remove(id);

			adapter.notifyDataSetChanged();
			break;

		default:
			break;
		}
		return super.onContextItemSelected(item);
	}


长按listview 删除listview的position

int[] location = newint[2] ;
view.getLocationInWindow(location);
//获取在当前窗口内的绝对坐标
view.getLocationOnScreen(location);//获取在整个屏幕内的绝对坐标,注意这个值是要从屏幕顶端算起,也就是包括了通知栏的高度

location [0]--->x坐标,location [1]--->y坐标
如果在Activity的OnCreate()事件输出那些参数,是全为0,要等UI控件都加载完了才能获取到这些。

WindowManager wm = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);

int width = wm.getDefaultDisplay().getWidth();//屏幕宽度

int height = wm.getDefaultDisplay().getHeight();//屏幕高度

Rect rect= new Rect();

this.getWindow().getDecorView().getWindowVisibleDisplayFrame(rect); //this.getWindow().getDecorView().

int statusBarHeight = rect.top; //状态栏高度

TextPaint tp = mTextView.getPaint();
tp.setFakeBoldText(true); ///** 将中文设置成粗体 ,英文直接使用android:textStyle="blod"即可*/

TextPaint 绘画出文字时添加一些额外的信息

textPaint.measureTex(String) 返回宽度

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值