Reputation: 2808
I have a small problem in this case in my app I set default Portrait.But now this time i want show Portrait and landScape in Tabs not only Mobile phone .In mobile phones show only Portrait(Force Update to Portrait).
I followed this link but I am getting this error and i dd't understand how can we create folders where can we place the data. I followed this link: but i didn't get
Android: allow portrait and landscape for tablets, but force portrait on phone?
Upvotes: 4
Views: 1747
Reputation: 2600
1.Go to the Android folder inside your RN Project,add values-sw600dp
and values-xlarge
to the following path:
android/app/src/main/res/values-sw600dp
android/app/src/main/res/values-xlarge
then add bools.xml
to values
,values-sw600dp
,values-xlarge
. the result:
2.Add code to MainActivity.java in the path android/app/src/main/java/com/[your project name]/MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getResources().getBoolean(R.bool.portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}
Upvotes: 1