English 中文(简体)
如何解决方向问题?
原标题:how to solve orientation issue?

我想拿出480x800、600x800、600x1024和800x1280决议。

i 必须显示方向(港口和景观),第600x800、600x1024和800x1280号决议以及第480x800号决议只显示景观模式。

现在,它显示了两种取向模式。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.nga.swp" android:versionCode="1" android:versionName="1.0">

    <supports-screens android:resizeable="true"
        android:largeScreens="true" android:normalScreens="false"
        android:smallScreens="false" android:anyDensity="true" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">

        <activity android:name=".MainActivity"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:label="@string/app_name" android:windowSoftInputMode="adjustPan">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".PhraseListActivity"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:label="@string/app_name" android:windowSoftInputMode="adjustPan" />

        <activity android:name=".ViewActivity" android:theme="@android:style/Theme.NoTitleBar"
            android:label="@string/app_name" />

    </application>

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_LOGS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

    <uses-sdk android:minSdkVersion="8" />

</manifest> 

my issue is how i am able to show landscape mode only with resolution 480x800. what changes i have to do in my menifest file.

最佳回答

有条件布局的最佳方法是在名册上使用合格的名录。

但就你而言,你需要改变roid子:筛选 您的活动方向。 地图册是显而易见的,似乎无法在你的活动布局中确定。

因此,我猜测,在你有关地雷的活动中,你必须使用守则。

首先是利用以下手段来进行筛选:

Display display = getWindowManager().getDefaultDisplay(); 
int width = display.getWidth();
int height = display.getHeight();

之后,有条件地利用:

if((width != 480) && (height !=800))
   setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

See ActativeInfo. ScreenOrientation, for furtherOrient.

问题回答

我认为,你应该这样做。

layout-land

layout

将你的xml放在这一位置。

480x800、600x800、600x1024和800x1280决议对此作了规定。

you should make drawable-ldip, drawable-mdip, drawable-hdip folder and put your images in that.

Android direct take & differentiated resolution.

首先通过使用:

Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();

然后使用<条码>、和<条码>。

开展下一次行动非常容易。

You can use OrientationListener in order to check the orientation.





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签