0

餘米設計的音樂播放器的佈局,但是當IM renderin與虛擬設備的Nexus 5,我不是面對所有如何獲得在各自的Android設備合適的圖片Android Studio中

image1

任何問題但時,即時通訊使用Nexus 7

image2

它顯示相同大小的圖像進行渲染。

也張貼我的照片的截圖。

希望從你們那裏得到一些解決方案。

+0

分享你的XML佈局,使用尺寸不同的屏幕尺寸 – Madhur

+0

IM希望你在每一個資源文件夾(如圖像的不同的屏幕尺寸。 LDPI,MDPI,華電國際,xhdpi,xxhdpi)?如果是的話,那麼問題是你的應用沒有爲你的設備獲得正確的圖像 –

+0

我還沒有問過這個問題。問這個提問者,看到第一個問問題@HirenPatel –

回答

0

你必須遵循這支持多種設備:在屏幕像素密度

變化。

xlarge screens are at least 960dp x 720dp 
large screens are at least 640dp x 480dp 
normal screens are at least 470dp x 320dp 
small screens are at least 426dp x 320dp 

讓這個佈局文件,因此,這將是相同的所有設備

res/layout/main_activity.xml   # For handsets (smaller than 600dp available width) 
res/layout-sw600dp/main_activity.xml # For 7」 tablets (600dp wide and bigger) 
res/layout-sw720dp/main_activity.xml # For 10」 tablets (720dp wide and bigger) 

對於Layout

res/layout/my_layout.xml    // layout for normal screen size ("default") 
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/graphic.png   // bitmap for medium-density 
res/drawable-hdpi/graphic.png   // bitmap for high-density 
res/drawable-xhdpi/graphic.png  // bitmap for extra-high-density 
res/drawable-xxhdpi/graphic.png  // bitmap for extra-extra-high-density 

對於圖標

res/mipmap-mdpi/my_icon.png   // launcher icon for medium-density 
res/mipmap-hdpi/my_icon.png   // launcher icon for high-density 
res/mipmap-xhdpi/my_icon.png  // launcher icon for extra-high-density 
res/mipmap-xxhdpi/my_icon.png  // launcher icon for extra-extra-high-density 
res/mipmap-xxxhdpi/my_icon.png  // launcher icon for extra-extra-extra-high-density 

對於啓動圖標

36x36 (0.75x) for low-density 
48x48 (1.0x baseline) for medium-density 
72x72 (1.5x) for high-density 
96x96 (2.0x) for extra-high-density 
180x180 (3.0x) for extra-extra-high-density 
192x192 (4.0x) for extra-extra-extra-high-density (launcher icon only; see note above) 

注:始終嘗試使用SP每當你處理textSize,像textsize=12sp

使用預定義textAppearance

It will set text size automatically as per device density. 

    <TextView android:textAppearance="?android:attr/textAppearanceSmall"/> 
    <TextView android:textAppearance="?android:attr/textAppearanceMedium"/> 
    <TextView android:textAppearance="?android:attr/textAppearanceLarge" /> 
Sample usage: 

    <TextView 
     style="@android:style/TextAppearance.Small" 
     android:text="Sample Text - Small" /> 
    <TextView 
     style="@android:style/TextAppearance.Medium" 
     android:text="Sample Text - Medium" /> 
    <TextView 
     style="@android:style/TextAppearance.Large" 
     android:text="Sample Text - Large" /> 

請訪問Supporting Multiple Screens

相關問題