gpt4 book ai didi

javascript - 调整多个 Android 平板电脑屏幕的大小不起作用

转载 作者:行者123 更新时间:2023-11-28 12:12:36 26 4
gpt4 key购买 nike

我已经通读了 screen support关于 Android 的部分并查看了 stackoverflow 上的其他帖子,但似乎没有任何解决方案适合我...

我正在使用 Cordova 2.9.0、JavaScript、HTML 和 CSS 来创建这个应用。

我尝试通过添加代码来更改 AndroidManifest.XML:

    <supports-screens android:smallScreens="false"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"
android:requiresSmallestWidthDp="600"
android:largestWidthLimitDp="720"/>

我也尝试过更改 res -> layout 下的 main.xml 代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World, ShowMeWhere"
/>
</LinearLayout>

这是该页面在 Android 模拟器中的样子: enter image description here

这也是我想要的样子(显示完整图像): enter image description here

感谢您的关注!

最佳答案

我找到了一个临时解决方案,但它看起来不太好,因为图像像素化了..

enter image description here

我通过将所有图像引用放入 <div> 来做到这一点然后使用 CSS 设置 max-heightmax-width每个 <div>的。

HTML代码:

CSS 代码:

.leftImage{
margin-left:5%;
max-width:45%;
max-height:65%;
}

.leftImage img{
max-width:100%;
max-height:100%;
}

关于javascript - 调整多个 Android 平板电脑屏幕的大小不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19398340/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com