我正在开发一个应用程序,我希望在ListView中实现滑动到解除功能 - 类似于我们在Android 4.0的通知栏,最近的应用列表或浏览器选项卡中看到的.我想在运行Android 2.2+的设备上运行该应用程序.请参见下图.我还想改变被擦掉项目的透明度 - 就像在ICS中一样.
Android 4.0 Web浏览器 - 轻扫打开的标签http://img19.imageshack.us/img19/3605/screenshot2012022617290.png
我在http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.0.1_r1/com/android/browser/上检查了ICS网络浏览器的来源.TabScrollView.java?av = f但无法确定哪个类特别负责实现此功能.
任何人都能指出我在正确的方向吗?我们可以使用Android兼容性库吗?请告诉我.非常感谢.
我正在使用大量静态方法对 SDK 进行单元测试。而且我不希望我在 test1() 中所做的操作影响我在 test2() 中所做的操作。在每次测试开始时,我需要 SDK 中的所有静态变量返回到未初始化状态,就好像它们没有加载一样。然后再次加载它们。关于如何做到这一点的任何建议?Robolectric 中是否有类似的规定?因为我用它来进行单元测试。在计划英语中,我基本上想要的是在每次测试开始时都有一个干净的石板。
@Test
public void test1() throws Exception {
// Setup all the device info values
MyDeviceInfoClass.setDeviceModel().equals("Nexus 4");
MyDeviceInfoClass.setDeviceOperatingSystem().equals("Android_3.4b5");
// Verify all the device info values set previously
assertTrue(MyDeviceInfoClass.getDeviceModel().equals("Nexus 4"));
assertTrue(MyDeviceInfoClass.getDeviceOperatingSystem().equals("Android_3.4b5"));
}
Run Code Online (Sandbox Code Playgroud)
那是第一次测试,它成功了。就是它应该的样子。然后在第二个测试中:
@Test
public void test2() throws Exception {
// Setup all the device info values
MyDeviceInfoClass.setDeviceOperatingSystem().equals("Android_4.2");
//The following line also succeeds if test1() is finished. But I do not want that. This line should throw an assertion error because we …Run Code Online (Sandbox Code Playgroud)