摘要: nMeasure方法在控件的父元素正要放置它的子控件时调用.它会问一个问题,“你想要用多大地方啊?”,然后传入两个参数——widthMeasureSpec和heightMeasureSpec. 它们指明控件可获得的空间以及关于这个空间描述的元数据. 比返回一个结果要好的方法是你传递View的高度和宽度到setMeasuredDimension方法里. 接下来的代码片段给出了如何重写onMeasure.注意,调用的本地空方法是来计算高度和宽度的.它们会译解widthHeightSpec和heightMeasureSpec值,并计算出合适的高度和宽度值.@Overrideprotected ... 阅读全文
posted @ 2013-05-01 12:37 编程小爬虫 阅读(269) 评论(0) 推荐(0) 编辑
摘要: package com.xfinder_logistics.view;import android.content.Context;import android.util.AttributeSet;import android.widget.GridView;public class MyGridView extends GridView{ public MyGridView(Context context, AttributeSet attrs) { super(context, attrs); } public MyGridView(C... 阅读全文
posted @ 2013-05-01 12:35 编程小爬虫 阅读(2052) 评论(0) 推荐(0) 编辑
摘要: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = (Button) findViewById(R.id.button); button.set... 阅读全文
posted @ 2013-05-01 01:17 编程小爬虫 阅读(478) 评论(0) 推荐(0) 编辑