Tag: 安卓

自定义布局行为

我怎样才能达到底线的这种行为 ? 它的工作方式类似于浮动动作按钮的滚动感知行为,但是当recyckerview滚动到底部时,它会拉动该面板(就像在回收视图中的最后一个元素就是该面板)。 我不认为开发者重复了这些观点。 也许有可能以某种方式扩展行为? 以下是滚动感知行为的代码: class ScrollAwareBehavior : CoordinatorLayout.Behavior<View> { constructor() : super() constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) override fun onStartNestedScroll(coordinatorLayout: CoordinatorLayout?, child: View?, directTargetChild: View?, target: View?, nestedScrollAxes: Int): Boolean { return nestedScrollAxes==ViewCompat.SCROLL_AXIS_VERTICAL } override fun onNestedScroll(coordinatorLayout: CoordinatorLayout?, child: View?, target: View?, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int) { […]

反序列化包含数组的Firestore文档的推荐方法是什么?

我试图获取包含数组的Firestore文档,但是,我无法使DocumentSnapshot.toObject方法在我添加数组后立即正常工作。 我不想使用集合,因为数组可能最多只包含1-2个项目。 java.lang.RuntimeException: Could not deserialize object. Failed to convert value of type com.google.android.gms.internal.zzegf to DocumentReference (found in field 'references.[0]') 以下是我的模特班 data class SomeModel( var references : ArrayList<DocumentReference> = ArrayList(0), var title : String? = null, var acronym : String? = null, var number : Long? = null ){ } 我的Firestore文档包含一个名为references的数组,其中包含一个DocumentReference 。 如果我从模型类中删除引用字段,对象反序列化就好了。

使用AnkoLogger级别以外的“信息”

我在我的Android项目中使用AnkoLogger ,但它只适用于日志级别是info ,其他级别什么都不记录,但内置的Android Log效果很好。 我能做些什么来使用AnkoLogger作为内置的替代品?

测试运行失败:由于'kotlin.UninitializedPropertyAccessException'导致测试运行失败

我遇到了一个问题,我的android仪器测试没有被发现。 相反,我得到以下内容: Started running tests Test running failed: Instrumentation run failed due to 'kotlin.UninitializedPropertyAccessException' Disconnected from the target VM, address: 'localhost:8600', transport: 'socket' Empty test suite.

Android系统。 Firebase:无法解析Android应用程序模块

我的build.gradle: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = '1.1.3-2' ext.realm_version = '3.7.2' repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.google.gms:google-services:3.1.0' classpath "io.realm:realm-gradle-plugin:$realm_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files […]

Android gradle构建在':app:mergeDebugResources'上突然失败,没有错误消息

我的gradle build完全停止了工作。 一分钟前它工作正常。 在gradle配置文件中没有改变任何东西; 事实上,我只是在改变XML中的应用程序风格。 制作,清洁和运行产品: Execution failed for task ':app:mergeDebugResources'. > -1 用–stacktrace运行–stacktrace会产生: Executing task ':app:mergeDebugResources' (up-to-date check took 0.031 secs) due to: Task ':app:mergeDebugResources' class path has changed from 35ff0c585719dc5a2e2e4d58900e722a to 01ad85243d44a7018a6f6b671ff7bf6b. All input files are considered out-of-date for incremental task ':app:mergeDebugResources'. Unable do incremental execution: full task run :app:mergeDebugResources FAILED :app:mergeDebugResources (Thread[Task […]

android anko alert自定义布局currentFocus

我有一个包含EditText的自定义布局的警报视图 activity.alert { var quantityEt: EditText? = null customView { linearLayout { orientation = LinearLayout.VERTICAL quantityEt = editText {} quantityEt!!.requestFocus() Log.e("LOL", ac.window.currentFocus.toString()) } } }.show() 那么我请求关注这个编辑文本。 但是, activity.window.currentFocus输出currentFocus android.support.v7.widget.RecyclerView。 我需要currentFocus是EditText。 我也尝试点击它来请求重点,但仍然得到了RecyclerView。 有没有办法做到这一点?

在自定义布局中定位充气的视图

我写了一个继承自RelativeLayout的自定义布局。 它有一个方法(在布局被膨胀后调用),当被调用时会膨胀一个视图,将其附加到布局,然后将其与布局相关联。 但是,当我尝试设置布局参数时,它似乎什么都不做: fun createCell() { // Inflate a cell and attach it to this val cell = inflate(context, eventCellId, this) // Setup layout params for the cell val params = RelativeLayout.LayoutParams(400, 400) // Lets force it to be 200 from the top params.topMargin = 200 // Set the cell layout params cell.layoutParams = params […]

“subs”类型的项目不能被使用。 回应:-1010:消费尝试无效

我正在尝试在应用程序中购买我的应用程序第一次,我得到这个错误。 付款成功完成,并成功消息后发生此错误。 请帮我解决这个问题。 提前致谢。 请检查这个代码 override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) { if (!mHelper!!.handleActivityResult(requestCode, resultCode, data)) { super.onActivityResult(requestCode, resultCode, data) } } fun buyClick(view: View) { mHelper!!.launchSubscriptionPurchaseFlow(this, ITEM_SKU, 10001, mPurchaseFinishedListener, "mypurchasetoken") } var mPurchaseFinishedListener: IabHelper.OnIabPurchaseFinishedListener = IabHelper.OnIabPurchaseFinishedListener { result, purchase -> Log.e(TAG, result.toString()) if (result.isFailure) { // Handle error Log.e(TAG, "failed") return@OnIabPurchaseFinishedListener } […]

从android应用程序内手动启动AutoBackup

我想为用户提供一个选项,使用Google的“自动备份”功能从应用内备份他们的数据。 我还没有发现任何相关的帖子。 使用ADB,我可以使用以下命令手动启动备份:adb shell bmgr backupnow 是否有可能从应用程序内做同样的事情? 我喜欢把这个功能与一个按钮相关联。