如何解决Android上的多屏支持
| 从最近几天开始,我试图创建一个可以根据模拟器的尺寸变化来调整屏幕的应用程序。我找到了使用多屏幕的解决方案。 但我无法做到这一点 我已从中寻求帮助,但无法理解我如何setContentView(R.layout.main);
?因为当我在R
之后按。(点)时,它不会向我显示以下文件夹.. :(
我已经在Android应用程序的the5ѭ文件夹下创建了3个文件夹,分别为layout-large
,layout-small
和layout-large-land
我已将其添加到清单文件中。
<supports-screens
android:largeScreens=\"true\"
android:normalScreens=\"true\"
android:smallScreens=\"true\"
android:anyDensity=\"true\" />
我在这里错过了什么?我正在使用android 1.6预先感谢
问题是我是否还必须将此main.xml
文件提供给默认的layout folder
文件?是的,然后对屏幕尺寸的变化没有影响,否,然后我强制使用了API level 7
,它强制关闭了我的应用程序,但问题仍然存在
这是我的xml文件
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"
android:layout_width=\"fill_parent\" android:id=\"@+id/rl\"
android:layout_height=\"360dip\">
<!--
<WebView android:id=\"@+id/webviewHelp\"
android:layout_width=\"fill_parent\"
-->
<!-- android:layout_height=\"fill_parent\" />-->
<WebView android:id=\"@+id/webviewHelp\" android:layout_width=\"fill_parent\"
android:layout_height=\"fill_parent\" />
<Button android:id=\"@+id/My_btn\"
android:layout_alignParentBottom=\"true\"
android:layout_alignParentLeft=\"true\" android:gravity=\"center\"
android:textSize=\"8px\" android:text=\"Download this mp3 file\"
android:textColor=\"@color/white\" android:layout_width=\"fill_parent\"
android:layout_height=\"28dip\" android:visibility=\"invisible\" />
<Button android:id=\"@+id/My_btn1\"
android:layout_alignParentBottom=\"true\"
android:layout_alignParentLeft=\"true\" android:text=\"this is button !\"
android:layout_width=\"0dip\" android:layout_height=\"0dip\"
android:visibility=\"invisible\" />
</RelativeLayout>
解决方法
请在这些文件夹中添加一些布局xml,然后再在R之后输入点号:)
文件夹本身不会生成资源ID,但是其中的xml文件会生成资源ID。
, 我不确定这就是您的意思,但这对我有用:
ScalingLinearLayout
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。