ID_ANDROID_CONTENT:The ID that the main layout in the XML layout file should have(XML中显示区域根视图的ID值,该视图由系统自动生成,未在XML中定义)
getTop、getBottom、getLeft、getRight:视图相对于父视图的位置
代码实例:
public class MainActivity extends Activity {
TextView mTextView;
Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
if(msg.what == 0) {
int contentTop1 = getWindow().findViewById(Window.ID_ANDROID_CONTENT).getTop();
Log.e("wangzihan","" + contentTop1);