我正在开发一个带有Activity和两种片段的Android应用程序.
类型1:具有可折叠工具栏和RecyclerView作为内容的片段.(有用).布局:
<android.support.design.widget.CoordinatorLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="250dp"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/indicaciones"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="@+id/anim_toolbar"
android:layout_width="match_parent"
android:layout_height="100dp"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/scrollableview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:clickable="true"
android:src="@android:drawable/ic_menu_add"
android:visibility="gone"
app:layout_anchor="@+id/appbar"
app:layout_anchorGravity="bottom|right|end" />
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
类型2:具有可折叠工具栏和WebView作为内容的片段.(这是问题所在).我试过通过"WebView"更改RecyclerView,它看起来像这样:
<android.support.design.widget.CoordinatorLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="250dp"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView …Run Code Online (Sandbox Code Playgroud) 我在我的Android应用程序中使用此库.(https://github.com/yazeed44/MultiImagePicker)
在此之前,我以这种方式将它添加到我的项目中:
compile 'net.yazeed44.imagepicker:imagepicker:1.3.0'
Run Code Online (Sandbox Code Playgroud)
据我所知,以这种方式导入它的问题是我无法覆盖任何代码,因为在重新构建项目之后我将丢失所有的代码.(我需要更改一些代码)
出于这个原因,我已经下载了源代码,并且我已经将项目导入为具有以下名称的模块:'imagepicker'
之后,我已将此行添加到我的app build.gradle中:
compile project(':imagepicker')
Run Code Online (Sandbox Code Playgroud)
这到我的settings.gradle(Android Studio做到了)
include ':app', ':imagepicker'
Run Code Online (Sandbox Code Playgroud)
在这之后,我尝试运行该项目,Android工作室显示此错误:
Gradle 'Project' project refresh failed
Error:Plugin with id 'com.github.dcendents.android-maven' not found.
Run Code Online (Sandbox Code Playgroud)
我不知道该怎么办.提前致谢
我需要安装我的项目的两个版本(生产和开发).我需要2个应用程序.我试图通过使用flavor来实现它,但是当我签署apk时,它总是使用相同的packageName(com.company.project)生成相同的应用程序.我尝试从defaultConfig中删除applicationId,但它也不起作用.在清单中,包名称是com.company.project.
谁知道怎么做?
这是build.gradle
defaultConfig {
multiDexEnabled true
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
applicationId "com.company.project"
}
productFlavors {
development {
applicationId
"com.company.project.DEV"
versionName "1.0-dev"
resValue "string", "app_name", "Project-Dev"
}
production {
applicationId
"com.company.project.PROD"
resValue "string", "app_name", "Project-Prod"
versionName "1.0-prod"
}
}
Run Code Online (Sandbox Code Playgroud)