Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android应用程序:我可以在7英寸平板电脑和10英寸平板电脑上展示不同的产品吗?_Java_Android - Fatal编程技术网

Java Android应用程序:我可以在7英寸平板电脑和10英寸平板电脑上展示不同的产品吗?

Java Android应用程序:我可以在7英寸平板电脑和10英寸平板电脑上展示不同的产品吗?,java,android,Java,Android,编辑:这不是重复发布。我不是在问如何为ANDROID实现不同的布局分辨率,而是如何以不同的分辨率动态列出产品,以便它们填充所需的空间。目前,10英寸显示屏上显示4行产品,7英寸显示屏上显示4行产品。这意味着用户需要在7英寸屏幕上垂直滚动才能查看所有内容。我希望产品动态填充空间,而不需要垂直滚动。感谢您提前提供的帮助。 res/layout/main_activity.xml # For handsets (smaller than 600dp available width)

编辑:这不是重复发布。我不是在问如何为ANDROID实现不同的布局分辨率,而是如何以不同的分辨率动态列出产品,以便它们填充所需的空间。目前,10英寸显示屏上显示4行产品,7英寸显示屏上显示4行产品。这意味着用户需要在7英寸屏幕上垂直滚动才能查看所有内容。我希望产品动态填充空间,而不需要垂直滚动。感谢您提前提供的帮助。

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)
res/layout-large                       # for 7" tablet (works on emulator and nexus7)

res/layout-xlarge                      # for 10" tablet (works on emulator and galaxytab10.1)
我正在帮助编写一个Android应用程序。在10英寸平板电脑中,我展示了4行产品(这就是我想要的)。在7英寸屏幕上,我应该只显示3行产品,但现在显示4行(如10英寸平板电脑),这导致了垂直滚动。是否可以编写代码在7英寸平板电脑上仅显示3行

我的产品只按预期左右移动-它不应该有垂直滚动


更具体地说,问题是:是否可以在10英寸平板电脑上动态显示4行产品,而在7英寸平板电脑上仅显示3行产品。为7英寸选择的布局较大。

7英寸和10英寸需要单独的布局

适用于7英寸平板电脑

  • 布局图-sw600dp

  • 布局图-sw600dp-端口

适用于10英寸平板电脑

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)
res/layout-large                       # for 7" tablet (works on emulator and nexus7)

res/layout-xlarge                      # for 10" tablet (works on emulator and galaxytab10.1)
  • 布局图-sw720dp

  • 布局图-sw720dp-端口

更新的示例

res/layout this is the default, it is needed even if you don't plan to support phones!
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)
res/layout-large                       # for 7" tablet (works on emulator and nexus7)

res/layout-xlarge                      # for 10" tablet (works on emulator and galaxytab10.1)
适用于3.2及以上版本的Android版本(>=3.2)

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)
res/layout-large                       # for 7" tablet (works on emulator and nexus7)

res/layout-xlarge                      # for 10" tablet (works on emulator and galaxytab10.1)
对于低于3.2版本的Android版本(<3.2)

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)
res/layout-large                       # for 7" tablet (works on emulator and nexus7)

res/layout-xlarge                      # for 10" tablet (works on emulator and galaxytab10.1)

7英寸屏幕不能同时使用
layout large
,10英寸屏幕不能使用
layout xlarge