经过漫长而耗时的搜索,我找不到一个可以在textview中为android API级别<= 11选择文本的组件.我写过这个可能对你有所帮助的组件:
public class SelectableTextView extends TextView {
public static int _SelectedBackgroundColor = 0xffA6D4E1;
public static int _SelectedTextColor = 0xff000000;
private OnTouchListener lastOnTouch;
protected int textOffsetStart;
protected int textOffsetEnd;
private OnLongClickListener lastOnLongClick;
protected boolean longCliked;
protected boolean isDowned;
protected int textSelectedEnd;
protected int textSelectedStart;
private static SelectableTextView lastInstance;
public SelectableTextView(Context context) {
super(context);
}
public void setTextIsSelectable(boolean selectable) {
// TODO:ANDROID3
// if:androidversion>=3
// super.setTextIsSelectable(selectable);
// else
super.setLongClickable(true);
super.setOnLongClickListener(getSelectableLongClick());
super.setOnTouchListener(getSelectableOnTouch());
}
private OnLongClickListener getSelectableLongClick() {
return new OnLongClickListener() { …Run Code Online (Sandbox Code Playgroud) 我用jquery.它在firefox中运行良好.但是当我通过ie8打开它时得到同样的错误:object dos not suport this property or method.第834行我禁用此行并在此行中找到相同的错误:836,3316,...
我制作示例代码并测试,它从不显示我的警报:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head id="Head1" runat="server">
<script type="text/javascript" src="jscripts/jquery-2.0.3.js"></script>
<script type="text/javascript" >
var isIE8 = $.browser.msie && +$.browser.version === 8;
var isIE8 = $.browser.msie && +$.browser.version === 8;
if ( isIE8 ) {
alert("ie8");}
alert("test");
...
Run Code Online (Sandbox Code Playgroud)
大家能帮帮我吗?谢谢!
这是我的代码:
LinearLayout imageViewParent = (LinearLayout) findViewById(R.id.imageViewParent);
ImageView view = new ImageView(this);
imageViewParent.addView(view);
view.setScaleType(ScaleType.MATRIX);
view.setBackgroundResource(R.drawable.np);
Run Code Online (Sandbox Code Playgroud)
在这个代码比例类型矩阵不起作用(它将图像固定到父母),但当我在xml中实现它时,它工作正常!每个人都可以帮助我吗?谢谢!
android中有没有后台工作者!我在这里使用了进度对话框
但没有建议的决心.我需要显示一个等待对话框,在我的流程结束后,执行其他流程.
我在本主题中使用了AsyncTask但我的进度对话框还没有立即显示!!
我想改变android日历时间.这是我的代码:
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, 10);
c.set(Calendar.MINUTE, 10);
c.set(Calendar.SECOND, 10);
Run Code Online (Sandbox Code Playgroud)
......其他代码和方法
System.out.println("h : " + Calendar.getInstance().get(Calendar.HOUR_OF_DAY));
System.out.println("m :" + Calendar.getInstance().get(Calendar.MINUTE));
System.out.println("s :" + Calendar.getInstance().get(Calendar.SECOND));
Run Code Online (Sandbox Code Playgroud)
但没有发生变化
get方法返回默认仿真时间
能帮我一个人吗?谢谢!