小编Lea*_*ays的帖子

设备中的APK安装错误

通过android studio安装apk时出错.

Failure [INSTALL_FAILED_INTERNAL_ERROR]

DELETE_FAILED_INTERNAL_ERROR
    Error while Installing APK
Run Code Online (Sandbox Code Playgroud)

我试过build:clean 也重启设备..错误无法解决.

android android-studio

25
推荐指数
2
解决办法
2万
查看次数

分层图像视图

查看我想要的

我想创建像上面的图像拇指..为此我创建了XML下面

activity_main.xml中

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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="match_parent"
    android:layout_height="match_parent"
    android:gravity="center">


      <View
            android:id="@+id/view1"
            android:layout_width="150dp"
            android:layout_height="150dp"
            android:layout_marginTop="10dp"    
            android:background="@drawable/images1">
        </View>
        <View
            android:id="@+id/view2"
            android:layout_width="150dp"
            android:layout_height="150dp"
            android:layout_marginTop="20dp"
            android:layout_marginLeft="10dp"
            android:background="@drawable/images1">
        </View>
        <View
            android:id="@+id/view3"
            android:layout_width="150dp"
            android:layout_height="150dp"
            android:layout_marginTop="30dp"
            android:layout_marginLeft="20dp"
            android:background="@drawable/images1">
        </View>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

但我创建的这个是在XML中手动添加的.并且可能会在不同的设备类型中产生不同的反应.有没有其他方法来创建这种类型的视图..

任何帮助接受.

谢谢.

xml android android-layout

13
推荐指数
2
解决办法
624
查看次数

粘性网格标题不适用于某些Android版本

我使用粘性网格标题与下面的应用程序Gradle依赖项.

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.tonicartos:stickygridheaders:1.0.1'
    testCompile 'junit:junit:4.12'

}
Run Code Online (Sandbox Code Playgroud)

并构建工具版本

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.stickyheader"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 8
        versionName '3'
        multiDexEnabled true
    }

 }
Run Code Online (Sandbox Code Playgroud)

Curruntly使用android studio 2.2.3.在我更新Android studio之前,它适用于所有设备,也适用于kitkat版本.在某些设备中特别是在kitkat下面崩溃,以及kitkat版本代码以上工作正常.

在kitkat设备的以下版本中,我收到了此错误, 堆栈跟踪

04-14 10:32:13.520 24869-24869/com.example.stickyheader E/AndroidRuntime:FATAL EXCEPTION:main java.lang.RuntimeException:无法启动活动ComponentInfo {com.example.stickyheader/com.example.stickyheader.CustomerEventDetailActivity }:android.view.InflateException:二进制XML文件行#62:android.app.ActivityThread.handleLaunchActivity在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2067)上的类com.tonicartos.widget.stickygridheaders.StickyGridHeadersGridView错误膨胀(ActivityThread.java:2092)在Android.app.Handler.dispatchMessage(Handler)上的android.app.ActivityThread.access $ 600(ActivityThread.java:133)android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1203) .java:99)在android.app.Looper.loop(Looper.java:137)的android.app.ActivityThread.main(ActivityThread.java:4794)at java.lang.reflect.Method.invokeNative(Native Method)at at com.android.internal.os.ZygoteInit $ MethodAndArgsC中的java.lang.reflect.Method.invoke(Method.java:511)aller.run(ZygoteInit.java:789)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)at dalvik.system.NativeStart.main(Native Method)引起:android.view.InflateException:二进制XML文件行#62:在android.view.LayoutInflater.rInflate(LayoutInflater.java:746)的android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)中输入com.tonicartos.widget.stickygridheaders.StickyGridHeadersGridView类错误android.view.LayoutInflater.inflate(LayoutInflater.java:489)android.view.LayoutInflater.inflate(LayoutInflater.java:396)android.view.LayoutInflater.inflate(LayoutInflater.java:352)android.support.v7 android.support.v7.app.AppCompatActivity.setContentView中的.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288)(AppCompatActivity.java:140)

另外这是我的粘性网格标题的Xml代码.

 <com.tonicartos.widget.stickygridheaders.StickyGridHeadersGridView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/gridViewCustomer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerHorizontal="true"
        android:animateLayoutChanges="true" …
Run Code Online (Sandbox Code Playgroud)

android gradle android-layout android-studio

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

什么是Android SearchView的搜索类型?

在提供UI的Android SearchView小部件中.它将搜索查询并向搜索提供程序提交请求.

BinarySearch等集合提供了不同类型的搜索查询...

Android Widget SearchView执行什么样的搜索查询.

(BinarySearch或LinerSearch或其他任何东西......)

android searchview

11
推荐指数
2
解决办法
564
查看次数

编译项目时出现匕首错误

使用匕首柄时出现以下错误

元数据版本不受支持。检查您的 Kotlin 版本是否 >= 1.0:java.lang.IllegalStateException:不支持的元数据版本。检查您的 Kotlin 版本是否 >= 1.0

请注意,我已经关注了 stackoverflow 和其他文档中的一些主题 Hilt Kotlin 中不支持的元数据版本

元数据版本不受支持。检查您的 Kotlin 版本是否 >= 1.0:java.lang.IllegalStateException

https://github.com/google/dagger/issues/2379

使用下面的应用程序 gradle 配置

 compileSdk 32

    defaultConfig {
        applicationId "com.test.plantdemo"
        minSdk 21
        targetSdk 32
        versionCode 1
        versionName "1.0"
}
Run Code Online (Sandbox Code Playgroud)

安卓插件

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
    id 'dagger.hilt.android.plugin'
}
Run Code Online (Sandbox Code Playgroud)

应用程序级别依赖

   dependencies {
implementation "androidx.work:work-runtime-ktx:2.5.0"
    kapt 'androidx.hilt:hilt-compiler:1.0.0'
    implementation 'androidx.hilt:hilt-work:1.0.0'
    kapt "com.google.dagger:hilt-android-compiler:2.35.1"
    kapt "com.google.dagger:hilt-compiler:2.35.1"
    implementation "com.google.dagger:hilt-android:2.35.1"
}
Run Code Online (Sandbox Code Playgroud)

我使用的顶级依赖项

 dependencies {
        // other plugins...
        //classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"
        classpath 'com.google.dagger:hilt-android-gradle-plugin:2.40' …
Run Code Online (Sandbox Code Playgroud)

android dependency-injection gradle kotlin dagger-hilt

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

更改android.support.v7.widget.SearchView的颜色

我正在使用搜索视图.

  <android.support.v7.widget.SearchView
            android:id="@+id/searchView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toLeftOf="@+id/imageViewMenu"
            >
  </android.support.v7.widget.SearchView>
Run Code Online (Sandbox Code Playgroud)

这可以更改文本颜色和图标颜色来查看吗?

目前它显示黑色文本和图标.我想将其更改为白色文本和白色搜索图标.

android android-layout searchview

6
推荐指数
4
解决办法
1万
查看次数

Gradle错误:无法打开zip文件

当我打开Project时会出错:

错误:无法打开zip文件.Gradle的依赖缓存可能已损坏(这有时会在网络连接超时后发生.)重新下载依赖项并同步项目(需要网络)

我试过这个: 错误:无法打开zip文件.Gradle依赖性缓存可能已损坏(这有时会在网络连接超时后发生.)

但不适合我.

这是我的build.gradle文件:

apply plugin: 'com.android.application'

android {
     compileSdkVersion 26
     buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.example.web"
        minSdkVersion 18
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.android.support:appcompat-v7:26.0.1'
      compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
allprojects {
repositories {
    jcenter()
    maven {
        url 'https://maven.google.com'
    }
    maven { url "https://jitpack.io" }

}
Run Code Online (Sandbox Code Playgroud)

顶级构建文件(项目级别)

// Top-level build file where …
Run Code Online (Sandbox Code Playgroud)

android gradle android-studio

5
推荐指数
0
解决办法
3648
查看次数

开发者控制台不显示旧版本的apk

在Google Play开发者控制台中,我上传了应用程序的10(10)个版本.但它只显示了最后三个版本的应用程序.

这是否可以在开发者控制台中显示旧版本?

是否有任何标准可以在google play开发者控制台上显示apk.

谢谢.

android google-play google-play-console

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

应用程序兼容主题的弹出菜单分隔符

我使用了 app compat theme style 。

  <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="android:popupMenuStyle">@style/PopupMenu</item>
        <item name="android:itemTextAppearance">@style/myCustomMenuTextApearance</item>
        <item name="android:listPopupWindowStyle">@style/PopupMenuStyle</item>

    </style>
    <style name="PopupMenuStyle" parent="Widget.AppCompat.ListPopupWindow">
        <item name="android:divider">@drawable/devider</item>
        <item name="android:dividerHeight">2dp</item>
    </style>

    <style name="PopupMenu" parent="@android:style/Widget.PopupMenu">
        <item name="android:popupBackground">@color/search_panel_color</item>
        <item name="android:textColor">@color/activity_button_text_color</item>
        <item name="android:shadowColor">@color/activity_theam_color</item>


    </style>

    <style name="myCustomMenuTextApearance" parent="@android:style/TextAppearance.Widget.TextView.PopupMenu">
        <item name="android:textColor">@color/activity_theam_color</item>
    </style>
Run Code Online (Sandbox Code Playgroud)

我想在我的菜单项中添加一个分隔符。我尝试了很多东西,但分隔线不适用......有没有办法显示分隔线?

android popupmenu

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

RecyclerView 滚动时项目大小发生变化

第一次recyclerView加载时会显示一切正常。但滚动后,布局项目大小发生了变化。

在此输入图像描述

这是我的item_layout

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:background="@drawable/item_border"
    android:layout_margin="@dimen/item_margin_2">
    <ImageView
        android:id="@+id/imageProduct"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@string/app_name"
        android:scaleType="centerInside"
        android:src="@drawable/ic_launcher_foreground"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
         />

    <TextView
        android:id="@+id/textProductTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@android:color/black"
        android:textSize="@dimen/title_textSize"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/imageProduct"
        tools:text="TubeLight" />

    <TextView
        android:id="@+id/textProductDetailSort"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="4dp"
        android:textColor="@android:color/black"
        android:textSize="@dimen/detail_textSize"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/textProductTitle"
        tools:text="warranty: 100 days" />


    <LinearLayout
        android:id="@+id/linerCartItem"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/textProductDetailSort">

        <ImageButton
            android:id="@+id/buttonRemove"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/item_border_small"
            android:src="@drawable/ic_outline_remove_24"/>

        <TextView
            android:id="@+id/textNumberItem"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimaryLight"
            android:textSize="@dimen/detail_small_textSize"
            android:padding="@dimen/item_padding"
            android:textColor="@color/black"
            android:layout_margin="@dimen/item_margin_3"
            android:text="0"/>

        <ImageButton
            android:id="@+id/buttonAdd"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/item_border_small"
            android:src="@drawable/ic_baseline_add_24"/>

    </LinearLayout> …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-imageview kotlin android-recyclerview

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