[英]What Image size I should keep in Android for Splash Screen?
我在Android中開發了應用程序並設計了一個大小為320x480的閃屏圖像。 我希望只在手機上運行此應用程序。 但是當我在模擬器中運行我的應用程序時,圖像被拉伸並且看起來不太好。 我已經閱讀了開發人員的文檔,但它對我沒有幫助。 所以基本上我想知道我應該定義什么尺寸的閃屏看起來像它的設計和圖像不應拉伸。
我的XML文件......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:background="@drawable/screenbackground"
android:gravity="bottom"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp" >
</ProgressBar>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/progressBar1"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="@string/loaddata"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" >
</TextView>
</RelativeLayout>
請給我建議或任何鏈接或資源。
謝謝
Android的
格式
9-Patch PNG (recommended)
外形尺寸
LDPI:
Portrait: 200x320px
Landscape: 320x200px
MDPI:
Portrait: 320x480px
Landscape: 480x320px
HDPI:
Portrait: 480x800px
Landscape: 800x480px
XHDPI:
Portrait: 720px1280px
Landscape: 1280x720px
我知道這是一篇很老的帖子,但是如果其他人偶然發現這篇帖子,我覺得它仍然需要對答案進行一些修改。 以下文章詳細介紹了在不同屏幕尺寸的Splash Screen中決定圖像分辨率所需的詳細信息:
Android屏幕大小為ldpi,mdpi,hdpi,xhdpi顯示? - 例如:ldpi為1024X768像素
對於像我這樣的懶惰開發者:P,我將提供以下最小屏幕尺寸(以像素為單位)的值,這些值由Google提供( 有關Google儀表板上設備相對尺寸的統計數據 )。
Android移動設備:
LDPI-426x320
MDPI-470x320
HDPI-640x480
XHDPI-960x720
Android平板電腦設備:
LDPI-200x320
MDPI-320x480
HDPI- 480x800
XHDPI- 720px1280px
當然,對於可伸縮圖像,始終建議使用9個Patch圖像。
嘗試在XML布局中設置視圖的大小,或者在Java文件中以編程方式執行。 您應該能夠按照自己的方式調整大小。 您可能還想確保圖像本身周圍沒有很多“空白”。
您應該支持不同大小的閃屏圖像並保存到相應的資源文件夾。 例如,以下是應用程序中的資源目錄列表,該列表為不同的屏幕尺寸提供不同的布局設計,為中,高和超高密度屏幕提供不同的位圖可繪制。
res/layout/my_layout.xml // layout for normal screen size ("default")
res/layout-small/my_layout.xml // layout for small screen size
res/layout-large/my_layout.xml // layout for large screen size
res/layout-xlarge/my_layout.xml // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation
res/drawable-mdpi/my_icon.png // bitmap for medium density
res/drawable-hdpi/my_icon.png // bitmap for high density
res/drawable-xhdpi/my_icon.png // bitmap for extra high density
有關詳細信息,請閱讀本教程
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.