This maybe somewhat of a strange question but I just can`t figure it out. Basically I have a class that extends View and overrides the onDraw method so it draws a bitmap wha
Override method onWindowFocusChanged()
in Activity
.
This is where you can be sure that views have been drawn. You can start obtaining the dimension/ position of the views in this method.
For eg. customView.getLeft()
, etc.
Well, if you instantiate the class that extends the View in your onCreate, that should work.
Take a look at this example:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set full screen view
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
requestWindowFeature(Window.FEATURE_NO_TITLE);
customView = new CustomView(this);
setContentView(customView);
customView.requestFocus();
}