2014-04-23 139 views

回答

0

你可以得到屏幕大小有问题在Java中,使检查

+0

我只针对正常屏幕不小,大,他们将只是正常的屏幕...在linearlayout使用webview,图像和谷歌广告3.2和4英寸只在正常屏幕下 – user3415586

0

请遵循:Supporting multiple screen size - Android

定义一样,

res/values-sw600dp/dimen.xml -> 7+ inches 
res/values-sw720dp/dimen.xml -> 10+ inches 
values-w360dp 
values-w500dp 
values-w480dp 
values-xlarge 
values-v11 
values-v14 

Sherlock Bar检查有

+0

可以给你一些链接我 – user3415586

+0

访问那个http:// stackoverflow。com/questions/9476662/how-to-set-android-layout-to-support-all-screen-sizes –

+0

res/layout/my_layout.xml //正常屏幕尺寸(“默认”)的布局... 3.2之间4.7英寸正常默认布局下只有..我正在使用imageview,webview,google添加线性布局 – user3415586

0
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 
+0

res/layout/my_layout.xml //正常屏幕尺寸的布局(“默认”)我只使用这种布局,想要支持从3.2英寸到4.7英寸的放置对齐从彼此变化 – user3415586

+0

@ user3415586是] – duggu

+0

我能做些什么来解决这个问题问题 – user3415586

0
您扪值

您需要为其创建不同的文件夹该

例如

布局文件夹/ main.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:background="@color/background" 
android:orientation="vertical" > 

<Button 
    android:id="@+id/rate" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_centerVertical="true" 
    android:text="Rate us" 
    android:textColor="@color/black_font" /> 

</RelativeLayout> 

布局大/ main.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:background="@color/background" 
android:orientation="vertical" > 

<Button 
    android:id="@+id/rate" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_centerVertical="true" 
    android:text="Rate us" 
    android:textColor="@color/black_font" 
    android:textSize="30sp" /> 

</RelativeLayout> 

布局XLARGE /主.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:background="@color/background" 
android:orientation="vertical" > 

<Button 
    android:id="@+id/rate" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_centerVertical="true" 
    android:text="Rate us" 
    android:textColor="@color/black_font" 
    android:textSize="60sp" /> 

</RelativeLayout> 

欲了解更多信息,请参阅this link

对于您的问题,您需要通过密度低的密度(LDPI)的屏幕

  1. ldpi资源来创建它(〜120DPI)。
  2. mdpi中密度(mdpi)屏幕资源(〜160dpi)。 (这是基准密度。)
  3. hdpi高密度(hdpi)屏幕资源(〜240dpi)。
  4. xhdpi超高密度(xhdpi)屏幕资源(〜320dpi)。
  5. nodpi所有密度的资源。这些是密​​度无关的资源。无论当前屏幕的密度如何,系统都不会缩放使用此限定符标记的资源。
  6. tvdpi屏幕资源介于mdpi和hdpi之间;大约213dpi。这不被视为“主要”密度组。它主要用于电视,大多数应用程序都不需要它 - 为大多数应用程序提供mdpi和hdpi资源已足够,系统会根据需要对其进行扩展。如果您发现有必要提供tvdpi资源,则应该将其大小设置为1.33 * mdpi。例如,mdpi屏幕的100px x 100px图像对于tvdpi应为133px x 133px。
+0

res/layout/my_layout.xml //正常屏幕尺寸(“默认”)的布局... 3.2至4.7之间英寸只有正常的默认布局..我正在使用图像eview,webview,谷歌添加线性布局 – user3415586