android-如何使用两个xml来使用屏幕定向。?
我是一个新的android开发者。我想添加两个XML文件。一个用于纵向屏幕,另一个用于横向屏幕。有人能给出一些解决这个问题的步骤吗 添加到清单文件中android-如何使用两个xml来使用屏幕定向。?,android,eclipse,Android,Eclipse,我是一个新的android开发者。我想添加两个XML文件。一个用于纵向屏幕,另一个用于横向屏幕。有人能给出一些解决这个问题的步骤吗 添加到清单文件中 <activity android:name="YourActivity" android:configChanges="orientation" android:label="@string/app_name" android:windowSoftInputMode="stateVisible|adjust
<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>
您可以为横向和纵向XML布局创建不同的布局文件夹。遵循以下步骤 1) 在res文件夹下创建一个名为layoutland的文件夹 2) 将所有横向xml文件复制到具有相同名称的layout Land文件夹中 3) 对该活动的清单进行此更改 android:configChanges=“方向”
我本来打算发布一个答案,但老实说,如果你点击重复链接,会更快;“这样你也会学到更多。”TimbiegeleisenYa告诉。想学more@Karnesh_Prabhu就像在一个示例项目中一样?它不起作用@Harshit Trivedithis并不是这个问题的答案。您应该提供一些关于如何使用布局xml文件的信息。这仅配置方向更改时的活动行为(是否重新启动活动)。
<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>