我正在使用VS2010(使用Windows 7).
每次我尝试运行单元测试时,它都会保持"待定"状态,并且测试无法完成.
我试着遵循这个msdn说明.
我尝试调试测试方法(测试视图/调试选择),设置断点,但VS2010指示:断点当前不会被命中...我正在调试配置.
有什么建议?
我有一个简单的preferences.xml:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<PreferenceCategory
android:title="First Category">
<CheckBoxPreference
....
Run Code Online (Sandbox Code Playgroud)
我的android版本是2.1(API7)java是1.6,使用eclipse indigo.在包浏览器中有android.jar,在我打开它之后有android.preference包.
即便如此,我收到以下错误:
com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- PreferenceCategory (Fix Build Path, Edit XML)
- PreferenceScreen (Fix Build Path, Edit XML)
Run Code Online (Sandbox Code Playgroud)
我该怎么办?Thanx提前
我有一个小应用程序,它使用自定义的LinearLayout,称为LinearlayoutOutlined.我想在其中绘制不同大小和彩色的盒子.它还有两个指示时间间隔的文本标签.在进行一些用户操作后,必须重新绘制布局.因此我按原样刷新布局
slotPanel.setDayBoundariesInMinutes( db, dw );
TimeSlot[] tSlots = nextDaysSlots.getGaps( dayOfWeek );
slotPanel.setItems( tSlots );
slotPanel.invalidate();
Run Code Online (Sandbox Code Playgroud)
其中slotpanel是LinearLayoutOutlined实例.
我检测到onDraw方法被不断调用.在特定的循环次数之后,它不会停止调用.
这是整个LinearLayoutOutlined类:
包com.widgets;
public class LinearLayoutOutlined extends LinearLayout {
private int workingTimeBeginsInMinutes;
private int workingTimeFinishesInMinutes;
private TimeSlot[] items;
private Rect outline;
private Paint strokePaint = new Paint();
SimpleDateFormat formatter;
public LinearLayoutOutlined( Context context ) {
super( context );
setWillNotDraw( false );
}
public LinearLayoutOutlined( Context context, AttributeSet attrs ) {
super( context, attrs );
setWillNotDraw( false );
}
public void …Run Code Online (Sandbox Code Playgroud) 我的任务是将一些t-sql查询重构为LINQ.简单连接和左外连接都很清楚.这是我的代码:
string[] leftouter = new string[] { "a", "b", "c", "d", "e" };
string[] inner = new string[] { "a", "b" };
var q = from s1 in leftouter
join s2 in inner on s1 equals s2 into j
from sj in j.DefaultIfEmpty()
select string.Format("Outer: {0} Left: {1}", s1, sj)
Run Code Online (Sandbox Code Playgroud)
输出是:
Outer: a Left: a
Outer: b Left: b
Outer: c Left:
Outer: d Left:
Outer: e Left:
Run Code Online (Sandbox Code Playgroud)
这是一个简单的左连接.现在我想添加一个新的数据集:
string[] rightouter = new string[] { "c", "d", "e" };
Run Code Online (Sandbox Code Playgroud)
所需的输出是: …
我有以下类来序列化:
[Serializable]
public class LabelRectangle {
[XmlAttribute]
public int X { get; set; }
[XmlAttribute]
public int Y { get; set; }
[XmlAttribute]
public int Width { get; set; }
[XmlAttribute]
public int Height { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
它将被序列化,看起来像这样
<LabelRectangle X="15" Y="70" Width="10" Height="1" />
Run Code Online (Sandbox Code Playgroud)
但我想得到以下结果:
<LabelRectangle X=15 Y=70 Width=10 Height=1 />
Run Code Online (Sandbox Code Playgroud)
这是序列化没有引号的int类型值.有可能吗?如果是的话?
我想使用未排序的泛型集合来存储值.
Set<Integer> map = new HashSet<Integer>();
map.Add( new Integer( 3 ) );
map.Add( new Integer( 2 ) );
map.Add( new Integer( 4 ) );
map.Add( new Integer( 1 ) );
Run Code Online (Sandbox Code Playgroud)
我想这些元素将是3,2,4,1.然后我想从这个集合创建一个数组:
Integer[] arr = ( Integer[] )map.toArray( new Integer[map.size()] );
Run Code Online (Sandbox Code Playgroud)
而且我很惊讶,因为arr中的元素与我放入地图的顺序不同.这笔交易是得到这样的数组:
arr[0] = 3;
arr[1] = 2;
arr[2] = 4;
arr[3] = 1;
Run Code Online (Sandbox Code Playgroud)
我该怎么办?