How do I make sure my app is only for vertical layout?
I have tried android:screenOrientation=\"portrait\"
but that doesn\'t seem to do the trick.
If you want some group of your activities to be locked on PORTRAIT mode only, than you can choose the next way:
public abstract class BasePortraitActivity extends Activity {
@Override
protected final void onCreate(Bundle state) {
super.onCreate(state);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
performOnCreate(state);
}
protected abstract void performOnCreate(Bundle state);
}
And than just extend BasePortraitActivity
where you need it. Or just add setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
to YourActivity.onCreate()
.