【问题标题】:How to make a sample demo project with Android Sliding panel in Android Studio如何在 Android Studio 中使用 Android 滑动面板制作示例演示项目
【发布时间】:2018-05-09 20:08:18
【问题描述】:

对于像我这样的初学者,谁能告诉我如何在 Android Studio 版本“0.8.6”中使用“https://github.com/umano/AndroidSlidingUpPanel”创建示例演示应用程序。

我已按照上述步骤添加 Android 滑动面板库 1) 从以下位置下载最新的稳定版本“https://github.com/umano/AndroidSlidingUpPanel/releases

2)解压压缩包

来自 YouTube 视频“https://www.youtube.com/watch?v=1MyBO9z7ojk

3)在根目录下创建了一个名为“libraries”的文件夹(应用名称为“slidingPanelTesting2”)

4)将解压后的目录复制到文件夹库中

5) 在settings.gradle中将第一行代码改为

include ':app', ':libraries:AndroidSlidingUpPanel:AndroidSlidingUpPanel-2.0.1'

6)在项目结构中(file->projectstructure) 单击模块部分的“应用程序”,在 Dependencies 选项卡中添加了模块 Dependency

libraries:AndroidSlidingUpPanel:AndroidSlidingUpPanel-2.0.1

7)点击应用后出现以下错误 Error:Configuration with name 'default' not found.

如果有人能回答那就太好了,因为我有很多相同问题的帖子没有任何答案

【问题讨论】:

    标签: android android-layout android-activity android-gradle-plugin build.gradle


    【解决方案1】:

    将此库添加到您的 Android Studio 项目要容易得多。首先撤消您之前的所有步骤 - 根本不需要它们。

    打开您的app文件夹的build.gradle 文件并将以下行添加到依赖项:

    dependencies {
        repositories {
            mavenCentral()
        }
        compile 'com.sothree.slidinguppanel:library:+'
    }
    

    完成! Android Studio 可能会抱怨存储库的东西不属于那里,所以只需将其移动到项目本身的 build.gradle 文件而不是应用模块。

    你的 build.gradle 文件最终应该是这样的:

    编辑

    正如 cmets 中提到的Scott Barta,如果您的存储库列表中已经存在 jcenter(),则不需要 mavenCentral()。 jcenter() 似乎是 mavenCentral() 的超集 - 在此处阅读更多信息:SO: Android buildscript repositories. jcenter VS mavencentral

    【讨论】:

    • 这是任何用户都能得到的最简单的答案,谢谢 :)
    • 对于一些遇到“未绑定前缀”错误的人,请参阅此页面stackoverflow.com/questions/22928573/…
    • 如果你已经有了 jcenter,一般不需要使用 mavenCentral 作为仓库。
    • @ScottBarta 感谢您指出这一点。我已经编辑了我的帖子。
    • 如何设置最小化 SlidingUpPanel 的高度?我希望我的面板即使在最小化状态下也应该显示四个 gridview 图像。用户可以将其滑动到顶部以查看完整的 gridview。如何增加最小化 sludinguppanel 的高度,以便显示更多内容?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-19
    • 2012-09-27
    相关资源
    最近更新 更多