我已将compileSdkVersion更新为26.这就是我的gradle文件现在的样子.
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId ##############
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
testCompile 'junit:junit:4.12'
}
Run Code Online (Sandbox Code Playgroud)
可以预见,我得到了支持库(25.3.1)和CompileSdkVersion(26)版本中不匹配(?)的警告.
我试图将支持库版本更新为以下版本:
问题
他们都没有工作.两种情况都显示Failed to resolve错误.点击Install Repository and sync project冻结Android Studio几秒钟,没有其他任何事情发生. …
EditText password = (EditText) view.findViewById(R.id.etPassword);
if (Build.VERSION.SDK_INT != android.os.Build.VERSION_CODES.KITKAT) {
Typeface typeface = TypefaceUtil.overrideFont(getContext(), "SERIF", "fonts/calibri.ttf");
password.setTypeface(typeface);
}
Run Code Online (Sandbox Code Playgroud)
这是XML的布局 TextInputLayout
<android.support.design.widget.TextInputLayout
android:id="@+id/inpPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/button_margin_small">
<android.support.design.widget.EditText
android:id="@+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:hint="@string/set_pass"
android:inputType="textPassword"
android:maxLength="@integer/pass_max"
android:maxLines="1"
android:password="true"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用此代码,但我的密码提示字体样式与我设置的不同.
我正在尝试在Flutter应用程序中使用Ether JS。我知道它没有直接支持,甚至现有的实现也没有得到很好的记录。
我有什么方法可以在适用于Android和iOS的Flutter应用程序中使用此库?也欢迎任何其他替代建议。
我已经尝试过js.dart,但无法弄清楚如何使用它。我什至不确定这是否是正确的选择。
我也尝试过Flutter WebView插件。
plugin.evalJavascript(
'function add(a,b){return a+b;}add(2,3);'
).then((s) {
print(s);
}
Run Code Online (Sandbox Code Playgroud)
该函数正确返回5作为响应。但是我不明白如何使用像这样的EtherJS库。
我是Flutter,Dart和JS的菜鸟。任何帮助将不胜感激。
问题:
我试图让它一直使用用户的位置并不断检查它是否在CLLocationCoordinate2D我设置的点的5 英里内。如果是这样,它会在应用程序打开时发送警报,或者在应用程序关闭时发送通知。
有用的信息:
在我的项目中,我有 4 个 swift 文件:
Locations.swift持有CLLocationCoordinate2D点。
Utilities.swift包含一个简单的警报。
UserLocation.swift检索并更新用户的位置
GeoLocationViewController.swift监控位置
笔记:
某些代码可能不在正确的位置或不相关,我正在查看另一个项目,试图从中提取相关代码以在我的项目中使用。请告诉我你是否发现了错误。
代码:
Locations.swift:
import UIKit
import MapKit
class Locations: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
var radius: CLLocationDistance = 5
let arroyo = CLLocationCoordinate2D (latitude: 33.781327997137595, longitude: -116.46394436519012)
var arroyoCoord: CLLocationCoordinate2D = arroyo
let buddyrogers = CLLocationCoordinate2D (latitude: 33.78051204742721, longitude: -116.46362250010833)
var buddyCoord: CLLocationCoordinate2D = buddyrogers
let chopsticks = CLLocationCoordinate2D (latitude: 33.815995425565184, longitude: -116.44107442645873)
let colorfulfountain = …Run Code Online (Sandbox Code Playgroud) 我知道如何创建椭圆形背景,我将此drawable添加到RelativeLayout背景:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#FFFFFF"/>
<corners
android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp"/>
</shape>
Run Code Online (Sandbox Code Playgroud)
但我想创建这个drawable和聊天的角落,如下所示:
如何在聊天的角落添加这个drawable?
我从我的朋友那里得到了一个颤振项目要完成。
我使用 Android Studio(AS) 作为编辑器。我已经在 AS 中安装了 flutter 和 dart 插件。现在,我通过在 AS 导入 AS 项目开始时选择选项导入了 flutter 项目。然后我不知道为什么它会向我显示设置 Dart SDK 的错误消息(Q1:我的第一个问题是为什么它给出错误我已经有了 dart 插件)。不知何故,我设法从这个链接中获得了 Dart并给出了直到 dart-sdk 文件夹的路径,如截图所示
现在我陷入了这个错误:
Because xxo_tag_xxxls depends on flutter_test any from sdk which doesn't exist (the Flutter SDK is not available), version solving failed.
Run Code Online (Sandbox Code Playgroud)
Flutter 用户应该运行flutter packages get而不是pub get.
我是Objective C的新手,但现在已经在Swift上工作了一段时间.我假设Objective c在逻辑上类似于swift.我在处理json数据请求时必须提供警报控制器; 所以我不得不使用dispatch async让它在swift中工作.这是我在Swift中使用的代码:
func alertMessage(message : String) -> Void {
let alert = UIAlertController(title: "Alert", message: message, preferredStyle: .Alert)
let okAction = UIAlertAction(title: "OK", style: .Default, handler: nil)
alert.addAction(okAction)
dispatch_async(dispatch_get_main_queue(),{
self.presentViewController(alert, animated: true, completion: nil)
})
}
Run Code Online (Sandbox Code Playgroud)
但我试图在目标C中做同样的事情
- (void)alertMessage : (NSString*) message {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Alert" message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:NULL];
[alert addAction:okAction];
[dispatch_async(dispatch_get_main_queue(), ^(void){
[self presentViewController:alert animated:true completion:NULL];
})];
}
Run Code Online (Sandbox Code Playgroud)
我收到错误"预期标识符".我究竟做错了什么?
我希望在 AppBarLayout 和布局之间锚定一个视图。我只在 Android Studio 编辑器上得到这种行为,但在真实设备上是不同的,如下所示:

我真的很困惑。我的代码是:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="view.activity.MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="84dp"
android:layout_marginTop="@dimen/activity_vertical_margin">
<!--views on toolbar-->
</RelativeLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/activity_home_content" />
<RelativeLayout
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:background="@drawable/circle_accent"
app:layout_anchor="@+id/whole_layout"
app:layout_anchorGravity="top|start">
<!--img view-->
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
和“ activity_home_content ”
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/whole_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="view.activity.MainActivity"
tools:showIn="@layout/activity_home_toolbar">
<!--some other views-->
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 首先,我在这个问题上苦苦挣扎了很长时间。我不知道该怎么办,所以我没有运气就遵循了这些步骤和教程。
还有关于StackOverflow的一系列问题。我也写了自己的代码。可能是我在做一些愚蠢的事情,但无法弄清楚。
mRecyclerView.setOnTouchListener((v, event) -> {
RectF rectf = new RectF((int) event.getX(),
(int) event.getY(),
0, 0);
boolean contains = getCenter(mHeaderPopUp).contains(rectf);
if (contains) {
Toast.makeText(mContext, "Clicked", Toast.LENGTH_SHORT).show();
}
return false;
});
private RectF getCenter(View view) {
Rect rect = new Rect();
view.getLocalVisibleRect(rect);
RectF dimens = new RectF((rect.left + rect.width() / 2),
(int) (rect.top + rect.height() / 2),
0, 0);
return dimens;
}
Run Code Online (Sandbox Code Playgroud)
因此,现在我已经尝试了所有这些方法,但是我无法通过recyclerview单击到recyclerview下面的视图,您可以在下图中看到该视图。recyclerview覆盖了屏幕上的所有视图,我需要将点击传递到下面的recyclerview上,我不想将这些视图放在recyclerview上方,因为当您滚动recyclerview时,它将被动画化并覆盖其所有视图。提前致谢。 这是图像
在创建对现有项目的XML进行更改时,我遇到了此错误.这就是我的XML看起来的样子
activity_month_view.xml
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.YearViewActivity">
<ImageView
android:id="@+id/month_view_prev_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_keyboard_arrow_left_black_24dp"
android:onClick="changeMonth"/>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
我的Java类
MonthViewActivity.java
public class MonthViewActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_month_view);
}
public void changeMonth(View view) {
//Some methods here
}
}
Run Code Online (Sandbox Code Playgroud)
该onClick属性显示此错误
Corresponding method handler 'public void changeMonth(android.view.View)' not found
Run Code Online (Sandbox Code Playgroud)
问题
我有一个Stream<List>正在多个类中监听的流,一旦将值添加到流中的列表中,我需要所有类接收更新的流。
我尝试过的
void main() {
StreamedList<String> dataStream = StreamedList();
dataStream.data.listen((list) => print(list));
dataStream.updateList(['Apple', 'Orange']);
dataStream.addToList('Mango'); // This is what I want to do
}
Run Code Online (Sandbox Code Playgroud)
StreamList这是类的代码
class StreamedList<T> {
StreamController<List<T>> _controller = StreamController.broadcast();
Stream<List<T>> get data => _controller.stream;
void updateList(List<T> list) {
_controller.sink.add(list);
}
void addToList(T value) {
// Is it possible to do this?
// List<T> dataList = await _controller.data;
// dataList.add(value);
// updateList(dataList);
}
void dispose() {
_controller.close();
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试了dart:async库中的不同 API Stream.first …
请多多包涵.我完全是C的新手,更不用说目标C.我正在努力做一些应该简单的事情,但它不起作用.我正在扫描一串也包含符号的数字.当迷你函数通过输入字符串运行时,它会将数字附加到一个新字符串,直到它遇到一个操作符(我正在以自己的方式编写一个计算器作为学习练习.)现在我只是在做开始部分并扫描字符串和追加字符.这是我的代码:
char userInput[99];
NSMutableString *number = nil;
int i;
printf( "Please enter math: " );
scanf( "%s", userInput );
fpurge( stdin );
NSString *InputString = [NSString stringWithUTF8String:userInput];
for (i=0; i < [InputString length]; i++) {
char current = [InputString characterAtIndex:i];
if (isalnum(current)) {
[number appendString:[NSString stringWithCharacters:¤t length:1]];
NSLog(@"%@ ", number);
}
}
Run Code Online (Sandbox Code Playgroud)
对于我的生活,我似乎无法弄清楚为什么它会保持打印2012-05-02 19:23:20.935 CALC[1447:403] (null)而不是它遇到的每个数字的数值.因此,例如,如果输入的字符串中有5个数字,它将打印5次.
背景
new_statecode.我正在使用HTML webresource来获取用户的输入,我后来打算将其传递给上面提到的自定义字段.
<input id="statecode" type="text" placeholder="">
这是脚本的代码.
document.getElementById("submitButton").addEventListener("click", function (event) {
var strstatecode = document.getElementById("statecode").value;
window.parent.Xrm.Page.data.entity.attributes.get("new_statecode").setValue(strstatecode);
});
Run Code Online (Sandbox Code Playgroud)
问题
这是我在控制台中遇到的错误.
Unable to get property 'setValue' of undefined or null reference
Run Code Online (Sandbox Code Playgroud)
我在尝试使用getValue属性时也遇到了类似的错误.
显然这是一个非常常见的问题,但其他解决方案都不适用于我.
到目前为止我做了什么
我检查了自定义字段名称.没有拼写错误或拼写错误.
我试过用 window.parent.Xrm.Page.getAttribute("new_statecode").setValue(strstatecode);
我尝试创建一个新的自定义字段,并尝试将值设置为它.那也行不通.它给出了同样的错误.
注1:我认为值得一提的是,我发布的代码已经过编辑和缩短,以符合SO 的mcve标准.我的HTML网络资源中还有6个其他输入(街道地址,城市等),我成功地将数据保存到CRM中各自的字段中.唯一的区别是那些不是自定义字段.
注意2:我使用的是Dynamics 365版本1612(8.2.1.410).
我该如何解决这个问题?还有什么我应该看的吗?也许在创建自定义字段时我应该注意什么?
原谅我在CRM术语上缺乏知识.
android ×6
dart ×3
ios ×3
flutter ×2
objective-c ×2
android-view ×1
c ×1
dynamics-crm ×1
geofencing ×1
geolocation ×1
javascript ×1
stream ×1
swift ×1