目标: - 在我的应用程序中设置背景图像,以纵向和横向模式填充设备
使用的工具:带有eclipse的Phonehgap
遇到的问题: -
我在谷歌搜索后添加的代码: -
1)在main.xml
中 <WebView android:id="@+id/appView"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
/>
2)在activity.java中
import android.util.Log;
import android.view.Display;
import android.webkit.WebSettings.RenderPriority;
import android.view.WindowManager;
import android.content.Context;
3)在索引页面
<meta name="viewport" content="target-densitydpi=device-dpi" />
or
<meta name="viewport" content="user-scalable=no, width=device-width" />
<link rel="stylesheet" href="homepage.css" type="text/css" media="only screen and (max-width: 480px)"/>
注意: - 其余代码是简单的html和css以及我们必须修改的所有手机间隙
赞成我想要: - 在告诉代码的同时请告诉我在哪里也包括,因为我是eclipse和phonegap的新手
提前thanx
答案 0 :(得分:4)
使用jquery mobile并且不使用作为平台的工具进行任何更改(例如eclipse for android) 并将图像填充到设备大小是简单的css
{
background-image:url('Images/indeximage.jpg');
background-size: 100% 100%;
background-repeat:no-repeat;
background-position:100% 100%;
top: 0px;
left: 0px;
}