小编Вла*_*ков的帖子

如何在Github上创建一个库,并通过Android Studio中的gradle依赖项使用它

我想创建库并通过Internet访问它.在Android Studio中(通过Gradle),可以通过以下方式添加依赖项:

build.gradle(模块应用程序)中:

dependencies {
    ...
    compile 'com.android.support:design:23.1.0'
    compile 'com.squareup:otto:1.3.8'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.j256.ormlite:ormlite-core:4.48'
    compile 'com.j256.ormlite:ormlite-android:4.48'
    ...
}
Run Code Online (Sandbox Code Playgroud)

如何从github以这种方式添加自己的库?

android github gradle android-studio jitpack

24
推荐指数
2
解决办法
7134
查看次数

Android数据绑定:Kotlin中的@BindingAdapter无法识别lambdas

这是我的BindingAdapter:

@BindingAdapter(value = *arrayOf("bind:commentsAdapter", "bind:itemClick", "bind:avatarClick", "bind:scrolledUp"), requireAll = false)    
fun initWithCommentsAdapter(recyclerView: RecyclerView, commentsAdapter: CommentsAdapter,
                        itemClick: (item: EntityCommentItem) -> Unit,
                        avatarClick: ((item: EntityCommentItem) -> Unit)?,
                        scrolledUp: (() -> Unit)?) {
    //Some code here
}
Run Code Online (Sandbox Code Playgroud)

initWithCommentsAdapter 是一个顶级功能

这是我的布局(必不可少的部分):

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:bind="http://schemas.android.com/apk/res-auto">

           <data>
               <variable
                   name="viewModel"
                   type="some.example.path.CommentsViewModel"/>
               <variable
                   name="commentsAdapter"
                   type="some.example.path.CommentsAdapter"/>
           </data>

           <android.support.v7.widget.RecyclerView
                ...
                bind:avatarClick="@{(item) -> viewModel.avatarClick(item)}"
                bind:itemClick="@{viewModel::commentClick}"
                bind:commentsAdapter="@{commentsAdapter}"
                bind:isVisible="@{viewModel.commentsVisibility}"
                bind:scrolledUp="@{() -> viewModel.scrolledUp()}"
            />
</layout>
Run Code Online (Sandbox Code Playgroud)

当我在布局中使用kotlin方法调用分配lambda时,我在构建期间出现了这样的错误:

e: java.lang.IllegalStateException: failed to analyze: 
java.lang.RuntimeException: Found data binding errors.
****/ data binding error ****msg:cannot find …
Run Code Online (Sandbox Code Playgroud)

android kotlin android-databinding

10
推荐指数
2
解决办法
1391
查看次数

Firebase/Core需要info.plist文件中的NSLocationWhenInUseUsageDescription

Firebase/Core在Podfile中添加了我的项目:

pod 'Firebase/Core'
Run Code Online (Sandbox Code Playgroud)

比我补充GoogleService-Info.plist.这是我所做的一切改变.

分析工作正常,因为我在Firebase控制台的DebugView中看到了我的设备中的一些活动.

但在将应用程序上传到商店后,我收到了一封带有此文字的信件:

缺少Info.plist密钥 - 此应用程序尝试在没有使用说明的情况下访问隐私敏感数据.应用程序的Info.plist必须包含一个NSLocationWhenInUseUsageDescription键,其中包含一个字符串值,向用户解释应用程序如何使用此数据.

Firebase的安装说明没有提到它

我想为我的应用程序分析.我怎么解决这个问题?出于什么原因我需要指定NSLocationWhenInUseUsageDescription密钥?

附加信息

  1. 我在这个应用程序版本中更新了xCode.
  2. GoogleService-Info.plist已启用IS_GCM_ENABLED标志.

ios firebase

10
推荐指数
1
解决办法
1735
查看次数

Intellij IDEA 插件开发。动作“创建 kotlin 类”

我想为Intellij IDEA创建一个插件。我需要添加一个动作(AnAction),将创建一个class科特林在自定义(不是Java) package。我有两个问题:

  • 如何创建具有所需扩展名的文件?
  • 或者如何在自定义中使用Kotlin class(来自某个基类)创建文件package

intellij-idea intellij-plugin kotlin

5
推荐指数
1
解决办法
560
查看次数

安卓。如何在值中更改 string.xml 的默认语言环境

我有一个只有俄罗斯语言环境的应用程序。如果我没有记错的话,则string.xmlres/values默认情况下是英语语言环境。但是英语和俄语有不同的复数形式。例如:

俄语:

  • 1,21,31..x1 ????
  • 2-4, 2(2-4), 3(2-4), .., x(2-4) ?????
  • 在其他情况下 - ????

用英语:

  • 1本书
  • n 本书

当用户将系统语言从俄语更改为其他语言时,问题就开始了。如何更改应用程序的默认语言?或者也许可以强制应用程序使用俄语复数?

android locale

4
推荐指数
2
解决办法
3277
查看次数

使用CoordinatorLayout中的WebView SwipeRefreshLayout

这是我的xml布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/coordinatorLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
            <include
                android:id="@+id/toolbar"
                layout="@layout/tool_bar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_scrollFlags="scroll|enterAlways" />
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipeContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <WebView
            android:id="@+id/web_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />

    </android.support.v4.widget.SwipeRefreshLayout>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

不幸的是,当webView滚动时,工具栏没有隐藏.

如何将WebView与SwipeRefreshLayout和可隐藏工具栏一起使用?

对不起我的英语不好.

android webview swiperefreshlayout android-toolbar coordinator-layout

1
推荐指数
1
解决办法
2348
查看次数