Androidはキーボードがイジェクトしているかどうかを判断
917 ワード
View activityView = this.findViewById(android.R.id.content)).getChildAt(0);
int height = activity.getHeight();
int screenHeight = this.getWindowManager().getDefaultDisplay().getHeight() - getStatusHeight();
if (height > 0 && height < screenHeight) {
//
}
//
public int getStatusHeight() {
Class> c = null;
Object obj = null;
Field field = null;
int x = 0, barHeight = 0;
try {
c = Class.forName("com.android.internal.R$dimen");
obj = c.newInstance();
field = c.getField("status_bar_height");
x = Integer.parseInt(field.get(obj).toString());
barHeight = CacheManager.get().getContext().getResources().getDimensionPixelSize(x);
} catch (Exception e1) {
e1.printStackTrace();
}
return barHeight;
}