I am a new android developer . I want to add two XML files. One for portrait screen and another for landscape. Can someone please give some steps to solve this problem?
Asked
Active
Viewed 153 times
-3
-
1I was going to post an answer but honestly it would be faster for you to follow the duplicate link; and you'll learn more this way too. – Tim Biegeleisen Aug 11 '17 at 09:08
-
@TimBiegeleisen ya tell. wanna learn more – Karnesh_Prabhu Aug 11 '17 at 09:12
-
@Karnesh_Prabhu as in a sample project? – Sufian Aug 11 '17 at 09:51
3 Answers
0
You Add into the Manifest file
<activity
android:name="YourActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:windowSoftInputMode="stateVisible|adjustPan" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Harshit Trivedi
- 764
- 9
- 33
-
-
this is just not an answer to the question. you should provide some information on how to use the layout xml files. this only configures the activities behavior on orientation changes (restart activity or not). – dedda1994 Aug 11 '17 at 09:20
0
you can make different layout folders for landscape and portrait XML layouts.

Chetan Joshi
- 5,582
- 4
- 30
- 43
0
Follow these steps
1) create a folder called layout-Land under the res folder.
2)copy all landscape xml files to that layout-Land folder with the same name.
3)Make this change to your manifest for that activity
android:configChanges="orientation"
<activity
android:name=".LoginActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:windowSoftInputMode="stateVisible|adjustPan" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Puneet Verma
- 1,373
- 2
- 19
- 23