Get the height of status bar

Get the height of status bar - Hello Friend GENERAL INFO FOR ANDROID DEVELOPMENT, In the article you read this time with the title Get the height of status bar, We have prepared this article for you to read and retrieve information there in. Hopefully the contents of postings Artikel Android code sample: general info, We write this you can understand. Alright, good read.

The Title : Get the height of status bar
link : Get the height of status bar

Read also


Get the height of status bar

Example to get the height of status bar, in size of pixel.



package com.blogspot.android_er.androidgetstatusbarheight;

import android.content.res.Resources;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

getStatusBarHeight();
}

private int getStatusBarHeight() {
int height;

Resources myResources = getResources();
int idStatusBarHeight = myResources.getIdentifier(
"status_bar_height", "dimen", "android");
if (idStatusBarHeight > 0) {
height = getResources().getDimensionPixelSize(idStatusBarHeight);
Toast.makeText(this,
"Status Bar Height = " + height,
Toast.LENGTH_LONG).show();
}else{
height = 0;
Toast.makeText(this,
"Resources NOT found",
Toast.LENGTH_LONG).show();
}

return height;
}

}




Thus Article Get the height of status bar

The End Article Get the height of status bar This time, hopefully can give benefits to all of you. well, see you in posting other articles.

You are now reading the article Get the height of status bar with the link address http://xorislogo.blogspot.com/2017/02/get-height-of-status-bar.html

0 Response to "Get the height of status bar"

Post a Comment