package com.sample.layouttest;import android.app.Activity;import android.os.Bundle;import android.util.Log;import android.view.View;import android.view.View.OnLayoutChangeListener;public class Main extends Activity implements OnLayoutChangeListener {    /** Called when the activity is first created. */    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        View newView = getLayoutInflater().inflate(R.layout.main, null);    newView.addOnLayoutChangeListener(this);    setContentView(newView);    }    @Override    public void onLayoutChange(View view, int left, int top, int right,            int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {        Log.d("LayoutTest","left="+left+", top="+top+", right="+right+", bottom="+bottom);    }}


On a Motorola Xoom running Android 3.1 (as well as a Samsung Galaxy 10.1V running 3.0), the output from the onLayoutChange method when entering portrait mode is :

05-24 15:11:43.047: DEBUG/LayoutTest(8658): left=0, top=0, right=800, bottom=1232 

and when entering landscape :

05-24 15:13:18.837: DEBUG/LayoutTest(8658): left=0, top=0, right=1280, bottom=752

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android(安卓)实现手写板技术
  2. android 播放铃声
  3. Android(安卓)Socket网络通信
  4. Android之SlidingDrawer滑动抽屉
  5. Android经纬度转化为距离
  6. android gps经纬度实时更新,获取卫星数量
  7. Android(安卓)ContentProviders数据共享
  8. android http请求并解析返回的xml
  9. Android(安卓)Studio 快捷键中英文对译
  10. android 获取手机的各种状态