LifeApp / LifeAppV1

1 stars 0 forks source link

Force Portrait #23

Closed sellnat77 closed 10 years ago

sellnat77 commented 10 years ago

Do we want to force a portrait orientation or allow the user to switch between portrait or landscape?

sellnat77 commented 10 years ago

If we do decide to force portrait we will be using this:

android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize"
jyoti2730 commented 10 years ago

i will go with portrait only. but if you want to switch between both we need to do it programmatically like this:

Button buttonSetPortrait = (Button)findViewById(R.id.setPortrait); Button buttonSetLandscape = (Button)findViewById(R.id.setLandscape);

buttonSetPortrait.setOnClickListener(new Button.OnClickListener(){

public void onClick(View arg0) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } }); buttonSetLandscape.setOnClickListener(new Button.OnClickListener(){

public void onClick(View arg0) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } });