在Monodroid中,我正在尝试访问GPS服务.我只需要一个位置对象.
这条线引出了一个错误:
java.lang.SecurityException异常
堆栈跟踪在Android.Runtime.JNIEnv.CallVoidMethod(IntPtr jobject,IntPtr jmethod,Android.Runtime.jValue [] params)[0x00000]中显示:0
我有最新版本的monodroid,我在三星Galaxy S II物理设备上运行它.
我认为它与Manifest文件有关 - 我怀疑有一个我缺少的属性,以便Monodroid可以生成一个清单,告诉设备我正在使用GPS服务.
我从http://docs.xamarin.com/android/advanced_topics/working_with_androidmanifest.xml了解到,Monodroid使用mandroid.exe生成自己的AndroidManifest文件.现在要么我必须自己修改AndroidManifest.xml文件,要么我必须让mandroid为我插入GPS东西.这是踢球者:没有上面链接所描述的"合并"文件 - 所以我只能通过mandroid来完成它.
那么我是否要为mandroid创建并添加一个新文件来合并?
这是我在做的事情:
...
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Locations;
...
namespace mynamespace
{
[Activity(Label = "My Activity")]
public class MainActivity : Activity, ILocationListener
{
...
#region Location Variables
LocationManager _locationManager;
#endregion
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.MainPage);
...
#region Location Setup
try
{
_locationManager = null;
if (/*user says to …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用以下代码将日期从字符串转换为NSDate:
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "E, dd MMM yyyy, KK:mma"
date = dateFormatter.dateFromString(strDate)
Run Code Online (Sandbox Code Playgroud)
我也尝试了以下格式:
但是输出总是零
使用格式化程序E,dd MMM yyyy,KK:mma将2016年1月12日星期二上午7:30转换为零
我还考虑了以下StackOverflow帖子:
我一直在使用此链接作为日期格式的参考
我想画一个这样的边框, Bordered Edittext
我的代码如下:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/blue" />
</shape>
</item>
<item
android:bottom="2dp"
android:left="2dp"
android:right="2dp">
<!--// add android:right="5dp" and android:left="5dp" for border on left and right-->
<shape android:shape="rectangle">
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp" />
<solid android:color="@color/bill_background" />
</shape>
</item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)
我设法做了这样的事情:我的 Edittext
我似乎无法调整左侧和右侧边框的高度。
我有一个listview与seekbar每个seekbar代表产品的值的100%.通过移动seekbar可以更改%值,我想在用户拖动时显示沿搜索条的值的变化seekbar.我不希望再添加一个文本框,值被更新.
我更关注在seekbar指针顶部显示一个小视图的选项,它会出现onStartTracking并消失onStopTracking事件.
有没有办法实现这个目标?
我正在尝试在KMMshared项目的模块中编写测试。在共享模块的 build.gradle.kts 文件中,我有以下内容:
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
//TODO: Hamcrest
//implementation("junit:junit:4.12")
//implementation("org.hamcrest:hamcrest-library:1.3")
//TODO: Mockk
//implementation("io.mockk:mockk:1.10.4")
}
}
//...
}
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
implementation(kotlin("[library]"))
Run Code Online (Sandbox Code Playgroud)
得到相同的结果:IDE 不再识别测试,我无法运行它们。