如何让我的相对布局显示我的图像视图,如下所示:

而不是这个?:

我希望我的布局尽可能多地显示图像并裁剪图像的外部,就像在桌面上将桌面背景图像设置为"填充"时一样:

到目前为止我的xml布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" android:fitsSystemWindows="true" android:alwaysDrawnWithCache="false">
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" android:src="@drawable/background_race_light"/>
<LinearLayout
android:id="@+id/linearLayout1"
style="@style/SessionResumeBar"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/home_resumeSessionBar_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="@+id/home_resumeSessionBar_buttonResume"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Resume" />
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我正在调用这个函数:
function submit_button(button_id){
$('#' + button_id).attr('type', 'submit');
}
Run Code Online (Sandbox Code Playgroud)
使这个按钮类型=提交而不是按钮:
<input name="confirm_button" id="confirm_button" type="button" value="Confirm" class="login_btn" />
Run Code Online (Sandbox Code Playgroud)
我得到这个错误(在Firefox中):
未捕获的异常:类型属性无法更改
有没有工作?
我在图像视图中显示一个外部图像,通过这样下载它:
bitmap = BitmapFactory.decodeStream((InputStream)new URL(url).getContent());
Run Code Online (Sandbox Code Playgroud)
然后将此位图设置为ImageView:
imageView.setImageBitmap(bitmap);
Run Code Online (Sandbox Code Playgroud)
除了其中一个图像是PNG并且在使用时失去透明背景,这一切都很好BitmapFactory.
谁能告诉我如何保持透明背景?
我有一个可拖动的div元素,它使用HTML 5 localStorage来记住它在用户页面上的位置.这很好用.
window.addEventListener如果在另一个打开的选项卡中拖动div,我也会使用它来更新位置.这可以工作,但div在一个浏览器选项卡中的位置稍微偏移到另一个选项卡中的div.有谁知道是什么原因造成的?
一个基本的例子如下.将其另存为html文件,并在两个不同的选项卡中打开以查看发生的情况.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<style type="text/css">
.note
{
position: absolute;
width:200px;
height:220px;
background: #2E2E2E;
top: 50px;
left: 50px;
transform:rotate(7deg);
-ms-transform:rotate(7deg);
-moz-transform:rotate(7deg);
-webkit-transform:rotate(7deg);
-o-transform:rotate(7deg);
}
</style>
<script type="text/javascript">
$(function () {
var note = $(".note");
updatePosition(note);
note.draggable({ stop: function () {
var left = $(this).position().left;
var top = $(this).position().top;
localStorage.setItem("left", left);
localStorage.setItem("top", top);
}
});
window.addEventListener("storage", function (e) {
updatePosition(note);
},
false);
});
function updatePosition(note) …Run Code Online (Sandbox Code Playgroud) 你为什么要使用$(window).unload(function(){});超过$(window).bind('beforeunload', function(){});
像上面那样使用 jQuery 绑定 beforeunload 和像这样直接分配它之间有区别吗:window.onbeforeunload = function() { };
谁能告诉我为什么这个kml文件不会在谷歌地图上显示?
我使用以下代码将其添加到地图对象,似乎与其他kml文件一起使用.
var kml = new google.maps.KmlLayer('http://www.emotination.com/kml/tasman.kml');
kml.setMap(map);
Run Code Online (Sandbox Code Playgroud)
Feed验证器说它有效并且谷歌服务器解析它不是太大?
地图只是放大到海洋!
这是基于客户端机器或浏览器还是其他什么?
例如,如果我使用 Chrome 匿名登录,在同一台机器上的 Firefox 中是否会使用相同的 UID?