編輯:關於android開發
@Override
public void onWindowFocusChanged(boolean hasFocus)
{
super.onWindowFocusChanged(hasFocus);
if (hasFocus)
{
int width = image.getMeasuredWidth();
int height = image.getMeasuredHeight();
Toast.makeText(MainActivity.this, "width = " + width + "---height = " + height, Toast.LENGTH_SHORT).show();
}
}
@Override
protected void onStart()
{
super.onStart();
image.post(new Runnable()
{
@Override
public void run()
{
int width = image.getMeasuredWidth();
int height = image.getMeasuredHeight();
Toast.makeText(MainActivity.this, "onstart--width = " + width + "---height = " + height, Toast.LENGTH_SHORT).show();
}
});
}
ViewTreeObserver observer = image.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener()
{
@Override
public void onGlobalLayout()
{
image.getViewTreeObserver().removeGlobalOnLayoutListener(this);
int width = image.getMeasuredWidth();
int height = image.getMeasuredHeight();
Toast.makeText(MainActivity.this, "onglobal--width = " + width + "---height = " + height, Toast.LENGTH_SHORT).show();
}
});
備注:以上image是ImageView控件
ImageView image = (ImageView)findViewById(R.id.image);
《Android Studio實用指南》12.18 文本搜索工具 Android Studio中提供了非常方便的搜索工具,可以在編輯器的文件中使用,也可以在andr
上次簡單地介紹了AudioRecord和AudioTrack的使用,這次就結合SurfaceVie
淺析MySQL數據庫OLTP基准測試sysbench是一款非常優秀的基准測試工具,它能夠精准的模擬MySQL數據庫存儲引擎InnoDB的磁盤的I/O模式。因此,基於sys
Android SharedPreference的使用,sharedpreference在《Android 在內部存儲讀寫文件》一文中,談到了登錄用戶名和密碼的方法,通過
Failed to apply plugin [id 'com.