我了解Android的开发者网站提供了有关此主题的信息.我已经阅读了以下三页:
他们没有提供我正在寻找的信息/统计数据.从第二个链接来看,支持的两个最重要的屏幕类别是normal-hdpi和normal-mdpi.
问题是,仅仅知道这两个类别最受欢迎对我没有帮助.该网站为我提供了这些类别的屏幕尺寸和密度范围,但范围非常大.
我想知道这两个类别中最流行的手机是什么.更具体地说,我正在寻找这两个类别中最受欢迎的决议.
我正在开发一个关于android version2.2的程序.我已经阅读了很多关于支持多种屏幕尺寸的文档但仍然感到困惑 我设计了一个支持大屏幕和普通屏幕的布局文件,当我尝试使用小屏幕时,它不会调整布局以适应屏幕.我也在清单中使用了这段代码.
<supports-screens
android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true"
/>
Run Code Online (Sandbox Code Playgroud)
小屏幕的图像就在这里. 如何设置与小屏幕兼容的屏幕?在某处我通过使用文件夹"layout-small"找到了,但是如果我使用它,项目大小正在增加,我不希望这样,那么任何人都可以建议我这样做的最佳方法吗?
据我了解,设备的匹配dpi和大小限定符不是基于实际屏幕属性(物理dpi和大小),而是基于设备制造商预定义的内容.
是否有不同设备的抽象dpi /尺寸列表?
我正在尝试创建一个应用程序,它有两个不同的平板电脑和手机用户界面,我正在使用片段来实现这一点.我为每个平板电脑和手机布局创建了两个单独的xml文件,两者都称为activity_main.xml,电话布局放在res/layout文件夹中,平板电脑布局放在res/layout-sw600dp文件夹中.
但是,当我尝试在Nexus 10模拟器(Android Studio)上运行我的应用程序时,它会自动转到默认的手机布局.该应用程序不会崩溃或任何东西,但它只是在手机用户界面中运行,当它应该在平板电脑用户界面运行时.我不知道这个错误的来源是什么,所以任何帮助将不胜感激.
这是一个更新,我尝试将文件夹重命名为res/layout-large-mdpi,但仍然没有发现任何变化.是否有可能与仿真器有关?
这是我的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidattack.www.sunshine" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.androidattack.www.sunshine.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.androidattack.www.sunshine.DetailActivity"
android:label="@string/title_activity_detail"
android:parentActivityName="com.androidattack.www.sunshine.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.androidattack.www.sunshine.MainActivity" />
</activity>
<activity
android:name="com.androidattack.www.sunshine.SettingsActivity"
android:label="@string/title_activity_settings"
android:parentActivityName="com.androidattack.www.sunshine.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.androidattack.www.sunshine.MainActivity" />
</activity>
<provider
android:authorities="com.androidattack.www.sunshine"
android:name=".data.WeatherProvider" />
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
sw600dp布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="?android:attr/dividerHorizontal"
android:baselineAligned="false"
tools:context="com.androidattack.www.sunshine.MainActivity">
<fragment
android:layout_width="0dp"
android:layout_height="fill_parent"
android:name="com.androidattack.www.sunshine.ForecastFragment"
android:id="@+id/fragment_forecast"
android:layout_gravity="center_vertical" …Run Code Online (Sandbox Code Playgroud) 我已经能够获得以下尺寸:
一组六个广义密度:
这些是尺寸:
但是使用诸如XXLarge和XXXlarge屏幕之类的设备的图像和图标大小的理想尺寸应该是什么。