屏幕分辨率

发布于 2024-10-08 08:20:39 字数 859 浏览 0 评论 0 原文

我主要从这两个来源学习 Android 和 Phonegap 开发:

http://news.softpedia.com/news/How-to-Run-Android-Applications-on-Ubuntu-115152.shtml

http://wiki.phonegap.com/w/page/30862722/phonegap-android-eclipse-quickstart

我有一台三星 Galaxy Tab。

但令我困惑的是:

  1. 我在开发过程中使用什么屏幕尺寸才能在 2010 年第 4 季度覆盖最多数量的 Android 手机和平板电脑?对于 480x800 屏幕,您推荐使用 WVGA800 吗?
  2. 即使我的 7 英寸三星 Galaxy Tab 具有高分辨率,大多数 Android 应用程序如何正确调整大小?开发人员正在采取哪些措施来实现这一目标?我的意思是,你能让你的应用程序具有某种弹性 字体也会拉伸吗?或者,Google 是否检测到该应用程序是为较小的屏幕设计的,因此它可以处理 Galaxy Tab 的大小调整?我是否需要更改 AndroidManifest.xml 中的某些内容
  3. ?模拟器,速度很快,当我切换到 WVGA800 时,它变得慢了很多,这是为什么?

I've been learning Android and Phonegap development from mainly these two sources:

http://news.softpedia.com/news/How-to-Run-Android-Applications-on-Ubuntu-115152.shtml

http://wiki.phonegap.com/w/page/30862722/phonegap-android-eclipse-quickstart

I have a Samsung Galaxy Tab.

What baffles me, though, are:

  1. What screen size do I use in development to reach the largest number of Android phones and tablets here in Q4 2010? Do you recommend WVGA800 for a 480x800 screen?
  2. How do most Android apps resize properly into my 7" Samsung Galaxy Tab even though it has a high resolution? What are the developers doing to achieve this? I mean, can you make your apps have a kind of stretchiness and the fonts stretch too? Or, is Google detecting the app was designed for a smaller screen and so it handles resizing for the Galaxy Tab? And do I need to change something in the AndroidManifest.xml?
  3. I used the HVGA default in the emulator, and it was zippy fast. When I switched to WVGA800, it got a lot slower. Why is that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

荒人说梦 2024-10-15 08:20:39

以下是我完全从 Android 开发人员的角度给出的答案(我没有使用 PhoneGap 的经验,所以我不能说这会如何影响事情):

  1. 对于我的大部分测试,我专注于 320x480 和 480x800。对于平板电脑,您还需要专门针对 Galaxy Tab 进行测试(请参阅三星网站有关在模拟器中测试的更多详细信息)。

  2. Android 中的布局通常被设计(或应该)支持任何屏幕尺寸。通常,视图设置为 MATCH_PARENT(以前为 FILL_PARENT)或 WRAP_CONTENT,因此它们的大小取决于它们所处的布局或它们包含的内容,而不是显示的大小。您还可以指定“DP”(与密度无关的像素),它会自动缩放(因此 2dp 在 HVGA 设备上为 2px,在 WVGA 设备上为 3px)。字体应该在 SP 中指定,这本质上是一样的,但也要考虑到用户的字体偏好。

    您还可以应用权重来拉伸视图。例如,如果您有一个水平方向的 LinearLayout,则可以在其中放置两个视图(假设一个 TextView 和一个 EditTextView)。您可以将它们的宽度和高度都设置为 WRAP_CONTENT,但您可能会向 EditTextView 添加layout_weight =“1”,告诉它填充剩余空间。此外,您还可以为大型设备创建特定布局,以自定义 Galaxy Tab 的显示。

  3. 分辨率越高,模拟器处理的像素就越多。您还会注意到 Android 版本之间的性能差异。

话虽这么说,看起来 PhoneGap 或多或少就像开发一个 WebApp,在这种情况下,您会发现 Android Web Apps 文章很有帮助。

编辑(自从我的格式变得混乱以来对第一条评论的回应):

不,除了指定您支持的内容之外,AndroidManifest 中没有任何需要更改的内容:

<supports-screens
  android:smallScreens="true"
  android:normalScreens="true"
  android:largeScreens="true"
  android:xlargeScreens="true"
  android:anyDensity="true" />

对于 CSS,您可以 根据密度指定样式或使用标准百分比、em 测量值等。

Here are my answers entirely from an Android developer's perspective (I have no experience with PhoneGap, so I can't say how that affects things):

  1. For the majority of my testing, I focus on 320x480 and 480x800. For tablets, you're also going to want to specifically test against the Galaxy Tab (see Samsung's site for more details on testing in the emulator).

  2. Layouts in Android are generally designed (or should be) to support any screen size. Typically Views are set to MATCH_PARENT (previously FILL_PARENT) or WRAP_CONTENT, so their size depends on either what layout they are in or what content they contain rather than how large the display is. You can also specify "DP" (density-independent pixels), which will scale automatically for you (so 2dp would be 2px on an HVGA device but 3px on a WVGA device). Fonts should be specified in SP, which are essentially the same thing but also take into account the user's font preference.

    You can also apply weights for stretching Views. For example, if you have a LinearLayout with horizontal orientation, you can put two Views in it (let's say a TextView and an EditTextView). You might set both of those to WRAP_CONTENT for their width and height, but you would probably add a layout_weight="1" to the EditTextView, telling it to fill the remaining space. In addition, you can create specific layouts for large devices to customize the display for the Galaxy Tab.

  3. The higher the resolution, the more pixels the emulator is handling. You'll also notice performance difference among the versions of Android.

That being said, it looks like PhoneGap is more or less like developing a WebApp, in which case you'll find the Android Web Apps articles helpful.

Edit (responses to first comment since my formatting was getting messed up):

No, there isn't anything to change in the AndroidManifest other than specifying what you support:

<supports-screens
  android:smallScreens="true"
  android:normalScreens="true"
  android:largeScreens="true"
  android:xlargeScreens="true"
  android:anyDensity="true" />

For CSS, you can specify styles based on density or use standard percents, em measurements, etc.

临走之时 2024-10-15 08:20:39

我已开始在我的清单中为可以在任何大小上运行的应用程序使用以下内容:

<supports-screens 
android:smallScreens="true"                   
android:normalScreens="true"                   
android:largeScreens="true"                   
android:anyDensity="true" />
<uses-sdk android:minSdkVersion="4"></uses-sdk>

I have begun using the following in my manifests for my apps that can run on any size:

<supports-screens 
android:smallScreens="true"                   
android:normalScreens="true"                   
android:largeScreens="true"                   
android:anyDensity="true" />
<uses-sdk android:minSdkVersion="4"></uses-sdk>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文