2015/11/01

Android 判斷螢幕橫向直向

if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
 Toast.makeText(this, "橫向", 1).show();
if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
 Toast.makeText(this, "直向", 1).show();