我会尝试开发一个可以绘制平面测量的应用程序.因此,每个房间都有自己的ID或名称,如果我触摸房间,我想显示带有该ID或名称的Toast消息.问题是如何检查是否以及触及了哪条路径!!
我看到很多讨论这个问题的主题讨论.有人说使用getBounds方法,之后包含检查触摸点是否在Rect中的方法.但是,我猜getBounds方法返回包含路径的最小Rect,对吧?
因此,房间有不同的自定义几何形式,因此,如果我约束了2个关闭房间,方法可以返回一组共享点.坏!每个房间只有他们的面积点.我怎么解决这个问题 ?
在iOS中我可以使用PathContainsPoint方法,但不幸的是,Android Path没有类似的东西.
我希望有人可以提前帮助我
我试图比较sha512编码的两个不同的字符串.但是,结果是不同的.它可能是一个编码问题我的意思.我希望你能帮助我.
这是我的Java代码:
MessageDigest digest = java.security.MessageDigest.getInstance("SHA-512");
digest.update(MyString.getBytes());
byte messageDigest[] = digest.digest();
// Create Hex String
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < messageDigest.length; i++) {
String h = Integer.toHexString(0xFF & messageDigest[i]);
while (h.length() < 2)
h = "0" + h;
hexString.append(h);
}
return hexString.toString();
Run Code Online (Sandbox Code Playgroud)
而且,这是我的C#代码:
UnicodeEncoding UE = new UnicodeEncoding();
byte[] hashValue;
byte[] message = UE.GetBytes(MyString);
SHA512Managed hashString = new SHA512Managed();
string hex = "";
hashValue = hashString.ComputeHash(message);
foreach (byte x in hashValue)
{
hex …
Run Code Online (Sandbox Code Playgroud) 我有一个项目,我在其中设置:
onCreate方法中的代码是这样的:
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
...
Run Code Online (Sandbox Code Playgroud)
使用以前的设置,一切正常!但是,如果我将minSdkVersion设置为11或更高,则会发生以下异常:
android.util.AndroidRuntimeException: You cannot combine custom titles with other title features
Run Code Online (Sandbox Code Playgroud)
我不明白为什么这只是改变minSdkVersion.我在这个网站上对这个问题大加红了.我尝试过设置:
由于我只使用API 11提供的功能,我想在加载商店App之前将minSdk设置为11.我能怎么做 ??我需要帮助
编辑:使用清单中的minSdkVersion = 10和Theme.NoTitleBar,会发生同样的错误.删除它,一切都像以前一样.当API为11或更高时,任何人都可以提供工作代码(清单和活动代码)来设置自定义标题吗?太多了
android titlebar tabactivity custom-titlebar android-tabactivity
更新(2020 年 7 月 15 日)
目前,mFeinstein 的回答是唯一给我第一个可接受的解决方案的答案。
题
我不得不问你做我想做的事情的最佳方法是什么:
所有这一切都没有冻结进度动画,就像不确定的进度条。
第一点和第二点没有问题。问题出现在第三次,当大量数据库插入在起作用时。我还不明白实现这些东西的正确方法是什么。
一些伪代码用于澄清
UI(显示对话框并运行进度条...)
void callWS() async {
MyProgressDialog _dialog = DialogHelper.showMyProgressDialog(_context, "Data", "Loading...");
await getDataFromService();
_dialog.close();
}
Run Code Online (Sandbox Code Playgroud)
连接(进度条上不会发生冻结)
static Future<void> getDataFromService() async {
String uri = MY_URI;
String wsMethod = MY_WS_METHOD;
String wsContract = MY_WS_CONTRACT;
SoapObject myRequest = SoapObject.fromSoapObject(namespace: my_namespace, name: wsMethod);
MyConnectionResult response = await _openMyConnection(myRequest, uri, wsContract, wsMethod);
if (response.result == MyResultEnum.OK) {
await _parseResponse(response.data);
}
}
Run Code Online (Sandbox Code Playgroud)
DATABASE(冻结发生在进度条上)
static …
Run Code Online (Sandbox Code Playgroud) I don't know why, but layout is shown well on device with Api 11+, isn't for older.
This is xml:
<LinearLayout
android:id="@+id/workers_linearlayout"
android:layout_width="50dp"
android:layout_height="70dp"
android:layout_weight="1" >
<RelativeLayout
android:id="@+id/workers_relative_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/workers_small" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:scaleX="0.5"
android:scaleY="0.5"
android:src="@drawable/ic_cerchio_rosso"
android:translationX="25dp"
android:translationY="-20dp" />
<TextView
android:id="@+id/workers_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="9"
android:textAppearance="?android:attr/textAppearanceMedium"
android:translationX="25dp"
android:translationY="-20dp" />
</RelativeLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
This is result on API 11+:
This on API 10-:
I tried to fix it playing with layouts …
我添加标记和标题的代码是这样的:
MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
annotationPoint.coordinate = coord;
annotationPoint.title = currentTitle;
[mapView addAnnotation:annotationPoint];
Run Code Online (Sandbox Code Playgroud)
是否可以在标记显示后立即在标记上显示标题并始终可见?非常感谢