我正在尝试迁移到新的Places SDK客户端,但我告知要在文档中安装的依赖项给我一个"无法解决"错误.我确保删除旧的SDK和places-compat库,然后清理和重建.
这是我的依赖列表:
dependencies {
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v13:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'android.arch.paging:runtime:1.0.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'org.jetbrains:annotations:16.0.2'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-ads:17.0.0'
implementation 'com.google.android.libraries.places:1.0.0'
implementation 'com.facebook.android:facebook-android-sdk:4.38.1'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
implementation 'com.google.firebase:firebase-firestore:18.0.0'
implementation 'com.firebaseui:firebase-ui-firestore:4.1.0'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-ads:17.0.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.6@aar') {
transitive = true
}
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
这是我的项目级gradle文件:
buildscript {
repositories …Run Code Online (Sandbox Code Playgroud) 我正在尝试关闭活动的持久性,但收到上面的消息。以下是我在 onCreate() 中配置设置的方法:
mFirestore = FirebaseFirestore.getInstance();
FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder().setPersistenceEnabled(false).build();
mFirestore.setFirestoreSettings(settings);
Run Code Online (Sandbox Code Playgroud)
如果不是之后我该在哪里调用它?
我有一个 Sticker 类及其包装器:
@JsonClass(generateAdapter = true)
class StickerDto(
@Json (name = "totalAnimatedStickers") val total: Int,
@Json(name = "pages") val pages: Int,
@Json(name = "data") val stickers: List<Sticker>
)
@JsonClass(generateAdapter = true)
class Sticker(
@Json(name = "name") val name: String,
@Json(name = "id") val id: String,
@Json(name = "stickerData") val stickerData: JsonObject,
var isSelected:Boolean = false
)
Run Code Online (Sandbox Code Playgroud)
StickerData 属性来自具有未知属性的动态 json 对象的 api
"stickerData": {}
Run Code Online (Sandbox Code Playgroud)
如何使用 Moshi 反序列化这样的对象?
我当前的改造客户:
private fun createNewFriendsClient(authRefreshClient: AuthRefreshClient,
preferencesInteractor: PreferencesInteractor): FriendsApiClient {
val logger = run { …Run Code Online (Sandbox Code Playgroud) 我正在开发一个Android应用程序,该应用程序将嵌入我们的客户拥有的非移动设备中,并由我们的客户的客户使用。我的老板正在为机器运行第二个应用程序,该应用程序在后台运行,并通过定期将有关设备的数据发送到后端Service。我采用了这种方法,尽管我知道这是不完善的,因为Android倾向于在任意指定的时间随意终止后台服务,即当它确定服务已过时或系统需要更多内存时。
也就是说,我们正在运行Android(v5.1.1)的开源版本。我想知道我的操作系统团队是否有可用的选项,这些选项对于那些构建适用于Google Android风格的应用程序不可用,是否可以通过某些方式删除那些已关闭的典型的日常维护机制或自动重启应用程序?
我正在创建一个聊天应用程序。当列表中当前最低的项目在屏幕上可见时,我试图让所有新消息都显示在聊天应用程序的底部,但当用户向上滚动时(就像大多数聊天应用程序一样)。截至目前,当屏幕上仍有未使用的空间时,我已经开始工作,但是当 RecyclerView 有太多视图无法容纳时,它开始将新消息从屏幕移到底部。这是我创建 RecyclerView 的方法:
private void initRecyclerView() {
mRecyclerView = findViewById(R.id.chatRecyclerView);
mAdapter = new ChatRecyclerViewAdapter(this, mMessages, mUsernames, mRoomID, mDatabaseReference);
mRecyclerView.setAdapter(mAdapter);
final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setStackFromEnd(true);
RecyclerView.AdapterDataObserver observer = new RecyclerView.AdapterDataObserver() {
@Override
public void onChanged() {
super.onChanged();
if(linearLayoutManager.findLastVisibleItemPosition()==(mAdapter.getItemCount()-1)){
mRecyclerView.smoothScrollToPosition(mAdapter.getItemCount()-1);
}
}
};
mAdapter.registerAdapterDataObserver(observer);
mRecyclerView.setLayoutManager(linearLayoutManager);
Run Code Online (Sandbox Code Playgroud) 我的ViewHolder意思是根据在RecyclerView带a 的两个列的左侧还是右侧出现不同的外观GridLayoutManager。注意视图两侧的连接线:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_marginTop="12px"
android:layout_marginBottom="12px"
android:layout_gravity="center"
android:gravity="center_vertical"
android:layout_height="wrap_content"
android:id="@+id/citation_select_holder">
<ImageView
android:src="@drawable/connector_line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/citation_select_connector_right"/>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="348px"
android:layout_height="104px"
android:layout_weight="1"
android:background="@drawable/button_background_white"
android:id="@+id/citation_select_citation_holder">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="28px"
>
<TextView
tools:text="123456"
android:textAppearance="@style/citation_select_item_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/citation_select_citation_number_text"/>
<TextView
tools:text="Pay by: Nov 18th, 2019"
android:textAppearance="@style/citation_select_item_due_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/citation_select_due_date_text"/>
<TextView
tools:text="a category label"
android:textAppearance="@style/citation_select_item_category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/citation_select_category_text"/>
</LinearLayout>
<TextView
tools:text="$10.00"
android:textAppearance="@style/citation_select_item_cost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:id="@+id/citation_select_cost_text" android:layout_marginRight="28px"/>
</RelativeLayout>
<ImageView
android:src="@drawable/connector_line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" …Run Code Online (Sandbox Code Playgroud) 我有一个 SwipeRefreshLayout 包含一个用于聊天活动的 RecyclerView。我将它的底部限制在屏幕底部的线性布局的顶部:
<android.support.constraint.ConstraintLayout 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="fill_parent"
android:layout_height="fill_parent"
android:background="@color/colorPrimaryDark"
android:paddingLeft="0dp"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="0dp"
android:paddingBottom="0dp"
tools:context="org.andrewedgar.theo.ChatRoomActivity">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/listFooter"
app:layout_constraintBottom_toTopOf="@+id/listFooter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/chatRecyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
app:layout_constraintBottom_toTopOf="@+id/listFooter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</android.support.v4.widget.SwipeRefreshLayout>
<LinearLayout
android:id="@+id/listFooter"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="@drawable/custom_border"
android:gravity="bottom"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<EditText
android:id="@+id/messageInput"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:ellipsize="start"
android:gravity="center"
android:hint="@string/prompt_msg"
android:imeActionLabel="@string/action_send"
android:imeOptions="actionUnspecified"
android:inputType="textCapSentences|textAutoCorrect"
android:maxLines="2"
android:textColor="@color/white"
android:textColorHint="@color/hintColor"
android:importantForAutofill="no" tools:targetApi="o"/>
<ImageButton
android:id="@+id/sendButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:contentDescription="@string/action_send"
android:padding="10dp"
android:src="@android:drawable/ic_menu_send" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
..但是 SwipeRefreshLayout 仍然占据整个屏幕并且消息出现在消息输入后面: …
我正在尝试在颤振中使用自定义字体。我已将字体放在根目录的“fonts”文件夹中,与我的 pubspec.yaml 文件处于同一级别
我还使用文档中的格式将字体添加到我的 pubspec.yaml 中。完整文件:
name: app_name
description: app_description
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
rxdart: ^0.22.1+1
intl: ^0.15.7
dev_dependencies:
flutter_launcher_icons: "^0.7.2"
flutter_test:
sdk: flutter
flutter:
fonts:
- family: Lato
fonts:
- asset: /fonts/Lato-Regular.ttf
flutter_icons:
ios: true
android: true
image_path_ios: "lib/res/launcher/ic_launcher_iphone.png"
image_path_android: "lib/res/launcher/ic_launcher.png"
Run Code Online (Sandbox Code Playgroud)
我仍然收到上述错误
Error: unable to locate asset entry in pubspec.yaml: "/fonts/Lato-Regular.ttf".