我试图在android中使用XML创建一个只有边框的圆圈:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<stroke android:width="1dp"
android:color="#000000"/>
</shape>
Run Code Online (Sandbox Code Playgroud)
我用过的代码在上面发布了.但是,我得到一个坚实的磁盘而不是一个戒指.我想使用XML而不是canvas来获取输出.我究竟做错了什么?
谢谢.
编辑: 感谢下面的答案让它工作.继承了我的最终代码:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="0dp"
android:shape="ring"
android:thicknessRatio="1.9"
android:useLevel="false" >
<solid android:color="@android:color/transparent" />
<size android:width="100dp"
android:height="100dp"/>
<stroke android:width="1dp"
android:color="#FFFFFF"/>
</shape>
Run Code Online (Sandbox Code Playgroud) 我需要在我的一个针对姜饼的Android应用程序中使用动作栏和片段的组合.所以我使用了v7支持库中的操作栏和v4支持库中的片段,并使用FragmentActivity扩展了我的类.
当我输入线路时出错
actionbar = getSupportActionBar();
Run Code Online (Sandbox Code Playgroud)
该错误表明,对于myFragmentClass(我的类名)类型,未定义getSupportActionBar().没有支持库,代码可以完美运行.我的问题有解决方案吗?
谢谢!
我正在使用Amazon Web Service将推送通知直接发送到设备.安装应用程序后,我获得了设备ID,我需要手动添加到Amazon SNS.我想知道是否有用户在启动应用程序时直接向amazon服务器注册设备ID.
我读过这个,但发现很难理解.有没有人有过如何做到这一点的经验?
编辑2(到目前为止我做了什么)
我已按照此链接中的说明操作
我按照说明下载了snspobilepush.zip文件,并将项目解压缩并导入到eclipse中.我添加GCM项目编号,添加jar文件并运行应用程序.我得到了我的设备注册ID.
我打开Amazon SNS,添加我的设备ID并发布消息.我在手机上收到了这条消息.到目前为止效果很好.
我的问题
我的应用程序会有很多潜在用户.因此,手动将每个设备ID添加到SNS是没有意义的.当我启动应用程序时,我需要Amazon SNS直接注册我的设备ID.我有什么选择吗?我在文档中找不到任何确定的答案.
此链接告诉我使用"AWS令牌自动售货服务".但是,我找不到任何如何做到这一点的例子.
我正在编译我的项目,ndk并且想c++_static用来构建我的项目。为此,我正在使用-
APP_STL := c++_static
Run Code Online (Sandbox Code Playgroud)
和
APP_CPPFLAGS := -std=c++11 -pthread -frtti -Wno-format-extra-args -Wno-format-zero-length -Wdeprecated-declarations -fno-builtin-cos -fno-builtin-sin -fno-builtin-cosf -fno-builtin-sinf -fexceptionsin
Run Code Online (Sandbox Code Playgroud)
在我的 Application.mk
但这给了我错误:
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:313:9: error: '::signbit' has not been declared
using ::signbit;
^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:314:9: error: '::fpclassify' has not been declared
using ::fpclassify;
^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:315:9: error: '::isfinite' has not been declared
using ::isfinite;
^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:316:9: error: '::isinf' has not been declared
using ::isinf;
^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:318:9: error: '::isnormal' has not been declared
using ::isnormal;
^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:319:9: error: '::isgreater' has not …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Mockito 编写单元测试。我有一个类需要进行如下测试-
open class Employee {
fun setDetails(name: String, age: Int) {
setName(name)
setAge(age)
}
fun setName(name: String) { }
fun setAge(age: Int) { }
}
Run Code Online (Sandbox Code Playgroud)
下面是我的测试课
class EmployeeTest {
@Mock
lateinit var emp: Employee
@Before
fun setup() {
MockitoAnnotations.initMocks(this)
}
@Test
fun testDetail() {
emp.setDetails("Henry", 23)
verify(emp, times(1)).setAge(23)
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的问题
当我做 -
verify(emp, times(1)).setAge(23)
Run Code Online (Sandbox Code Playgroud)
这给了我成功,因为 setAge 在 Employee.kt 的 setDetails() 中被调用一次。所以这对我来说很好用
但是,当我这样做时——
verify(emp, never()).setAge(23)
Run Code Online (Sandbox Code Playgroud)
即使在 setDetails() 中调用该方法,这仍然使我成功。这个测试用例不应该失败吗?
请帮助我理解这一点。我一直无法弄清楚为什么会发生这种情况。
编辑 这对我有用,我使用间谍而不是模拟。但是,我还必须在 Kotlin 中将这些方法声明为 open。
我一直在尝试使用动画矢量可绘制图标实现闪烁动画。我正在寻找的效果与此类似-
我已经使用FaceBook shimmer 库来获得这种效果,尽管这正是我所需要的,但我想使用矢量动画来获得这种效果,因为仅仅为此动画包含一个库是没有意义的。谁能给我任何关于如何做到这一点的提示或起点。
我对Shape Shifter相当满意,但我还无法实现这个动画
谢谢!
我正在尝试使用Universal Image Loader Library 获取位图资源.我已经覆盖了onLoadComplete()方法,如下所示:
loader.displayImage(thumbnail.get(position), hold.ivThumbnailReflection, options, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String arg0, View arg1) {
// TODO Auto-generated method stub
}
@Override
public void onLoadingFailed(String arg0, View arg1, FailReason arg2) {
// TODO Auto-generated method stub
}
@Override
public void onLoadingComplete(String urlLink, View arg1, Bitmap loadedImage) {
Log.i("loading complete","loading complete "+loadedImage);
hold.ivThumbnail.setImageBitmap(loadedImage);
}
@Override
public void onLoadingCancelled(String arg0, View arg1) {
// TODO Auto-generated method stub
}
});
Run Code Online (Sandbox Code Playgroud)
图像在ivThumbnailReflection视图中设置,但视图上没有图像ivThumbnail.当我为loadedImage打印对象时,我得到一个表格 - android.graphics.Bitmap@4170f1d0. …