Я создаю простое тестовое приложение «Target SDK API 16 (4.1 Jelly Beans)». Экран 3.7 (480x800 hdpi).Как изменить размер, совместимость, настроить размер экрана для всех устройств Android.
это приложение отлично смотрится на 3.7 (480x800), но когда я запускаю его на другом экране, например: 2.7 (240x320), 7.0 (1024x600), 10.1 (1280x800), его разрешение экрана становится испорченным или выглядит плохо.
для лучшего понимания см скриншот:
2,7 (240x320)
http://postimg.org/image/m3sob88mp/
3,7 (480x800)
http://postimg.org/image/wf513w0c1/
7,0 (1024x600)
http://postimg.org/image/fc298djn5/
10,1 (1280x800)
http://postimg.org/image/isk5gon7p/
я хочу, чтобы это совместимо/выглядеть идеально со всеми размерами экрана так же, как это выглядит в 3.7 (480x800)
Как изменить размер, совместимость, настроить размер экрана для всех устройств Android, чтобы он выглядел идеально в канун ry разрешение экрана.
или мне нужно будет создать другое приложение или другой размер экрана.
, что я пытался сделать экран совместим: добавил эти строки в "AndroidManifest.xml"
<supports-screens>
android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"
</supports-screens>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.usd.quiztest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<supports-screens>
android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"
</supports-screens>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.usd.quiztest.Logo"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.usd.quiztest.First"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.usd.quiztest.Q1"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.usd.quiztest.Q2"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.usd.quiztest.Q3"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.usd.quiztest.Q4"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.usd.quiztest.Q5"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.usd.quiztest.FinalPage"
android:label="@string/app_name" >
</activity>
<activity
android:name="com.usd.quiztest.Score"
android:label="@string/app_name" >
</activity>
</application>
</manifest>
first_screen.xml (это экран, который показан на снимке экрана)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:contentDescription="ql"
android:gravity="center"
android:src="@drawable/ql" />
<Button
android:id="@+id/start_button"
android:layout_width="254dp"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:text="Start Quiz Test"
android:textColor="#000000" />
</RelativeLayout>
Для всех устройств вам необходимо использовать разные чертежи. Как hdpi, mdpi, xhdpi и т. Д. Это позволит выбрать изображения в соответствии с предпочтениями устройства. –
Для справки: http://developer.android.com/guide/practices/screens_support.html –
Покажите нам свой макет. xml, я подозреваю некоторые ошибки там. – Leandros