小编hat*_*ata的帖子

项目根目录和app文件夹中的两个build.gradle有什么区别?

我刚刚注意到我的项目中有两个 build.gradle 文件。是因为我在导入项目时使用了gradlewrapper吗?

在Android Studio中,项目根目录中的build.gradle和app文件夹中的build.gradle有什么区别?

android android-studio build.gradle

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

在 LibGDX 中保存和检索图像文件

如何在 LibGDX 中保存和检索图像文件。我想在 AndroidApplication 类的本地存储中保存一个图像文件,并在我的核心项目中检索它。

java android libgdx

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

Android Studio 不同视图的区别

我最近开始使用 Android Studio 并观察了左上角可用的不同视图,其中包括 (Project, Packages, Android, Scratches) 等选项。我正在寻找它,但没有得到每个的意义和它们之间的区别。任何人都可以帮助我吗?

下拉菜单的屏幕截图

谢谢

android android-studio

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

无法从Google官方网页获取Google Analytics配置文件

现在,我想将Analytics添加到我的Android应用程序,然后我阅读官方页面.

它说我必须从页面获取配置文件.所以我点击了GET A CONFIGURATION FILE按钮.但没有任何反应!

加载圈动画永远滚动!

加载圈动画永远滚动!

  • 我有一个开发者帐户和一个Google Analytics帐户,并已登录.
  • 我在Ubuntu GNOME 15.04上使用Chromium或Firefox.

android google-analytics google-analytics-firebase

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

setfitsystemwindows不工作windowtranslucentstatus coordinatorlayout

我正在开发一个小型的Android项目.我在显示状态栏下方的工具栏时遇到一些问题.我使用以下配置:

  • 支持库版本23.2.0
  • windowTranslucentStatus = true

<CollapsingToolbarLayout fitSystemWindows="true" ...>
<FrameLayout fitSystemWindows="true" ...>
<ViewPager>
....consists a fragment with framelayout and image
</ViewPager>

<Toolbar fitSystemWindows="true" ...>

</FrameLayout>

<CollapsingToolbarLayout fitSystemWindows="true"...>
.....
</AppBarLayout>
</CoordinatorLayout>`
Run Code Online (Sandbox Code Playgroud)

图像显示正确但不显示工具栏

<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true">

<android.support.design.widget.AppBarLayout
    android:id="@+id/fragment_musicplayer_appBarlayout_test"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true">

<android.support.design.widget.CollapsingToolbarLayout
    android:id="@+id/fragment_musicexplorer_album_collapsingtoolbarlayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    app:contentScrim="#eab22b"
    app:expandedTitleMarginStart="48dp"
    app:expandedTitleMarginEnd="64dp"
    app:layout_scrollFlags="scroll|exitUntilCollapsed">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_collapseMode="parallax"
        android:fitsSystemWindows="true">
        <android.support.v4.view.ViewPager
            android:id="@+id/fragment_musicplayer_viewpager_test"
            android:layout_width="match_parent"
            android:layout_height="450dp" />

        <android.support.v7.widget.Toolbar
        android:id="@+id/fragment_musicplayer_toolbar_test"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@android:color/transparent"
        android:fitsSystemWindows="true" />
    </FrameLayout>
</android.support.design.widget.CollapsingToolbarLayout>
Run Code Online (Sandbox Code Playgroud)

android statusbar android-support-library android-collapsingtoolbarlayout

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

Android 设计库 Snackbar - 获取 TextView 返回 Null

我正在尝试获取Snackbar's TextView。这是我正在使用的代码:

 Snackbar snackbar = Snackbar.make(mRecyclerView, message, Snackbar.LENGTH_LONG);
 View view = snackbar.getView();
 TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
Run Code Online (Sandbox Code Playgroud)

运行上面的总是设置tv为空。我正在使用设计库版本23.0.0,在小吃店的布局资源中,我可以看到TextViewwith id snackbar_text。我错过了什么?

android android-design-library android-snackbar

5
推荐指数
2
解决办法
3603
查看次数

Google Play 游戏服务登录错误:ApiException:4

我正在 Android studio 中开发一个应用程序,该应用程序使用 Google Play Games 服务来获取成就和排行榜,但我在尝试登录时收到错误。我按照文档操作,我的所有密钥和 OAuth 代码都匹配并且仍然当我尝试登录时收到此错误:

com.google.android.gms.common.api.ApiException:4:4:

我到处寻找答案,重新启动所有凭据,取消发布,然后发布所需的所有新内容,检查所有 ID。如果有人能给我一些关于还可以尝试什么的建议,我将非常感激。

com.google.android.gms.common.api.ApiException: 4: 4: 
    at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source)
    at com.google.android.gms.common.internal.zai.zaf(Unknown Source)
    at com.google.android.gms.common.internal.zaj.onComplete(Unknown Source)
    at com.google.android.gms.common.api.internal.BasePendingResult.zaa(Unknown Source)
    at com.google.android.gms.common.api.internal.BasePendingResult.setResult(Unknown Source)
    at com.google.android.gms.auth.api.signin.internal.zzj.zzc(Unknown Source)
    at com.google.android.gms.auth.api.signin.internal.zzt.dispatchTransaction(Unknown Source)
    at com.google.android.gms.internal.auth-api.zzd.onTransact(Unknown Source)
    at android.os.Binder.execTransact(Binder.java:461)
Run Code Online (Sandbox Code Playgroud)

这是 Google 文档中用于登录的代码。

private void startSignInIntent() {
    GoogleSignInClient signInClient = GoogleSignIn.getClient(
        this, GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN
    );
    Intent intent = signInClient.getSignInIntent();
    startActivityForResult(intent, RC_SIGN_IN);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == RC_SIGN_IN) …
Run Code Online (Sandbox Code Playgroud)

android google-play-services google-play-games

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

为什么`findViewById` 返回null?(使用`by lazy`)

我以那个小项目为例:

主活动.kt

package com.example.scratch

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.activity_main)
    }
}
Run Code Online (Sandbox Code Playgroud)

布局/activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.example.scratch.CustomViewWithContent
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

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

CustomViewWithContainer.kt

package com.example.scratch

import android.content.Context
import android.util.AttributeSet
import android.view.Gravity
import android.view.View
import android.widget.FrameLayout
import androidx.constraintlayout.widget.ConstraintLayout

open class CustomViewWithContainer : ConstraintLayout {

    private val contentContainer by lazy {
        findViewById<FrameLayout>(R.id.content_container)
    }

    constructor(context: Context?) : super(context) {
        commonInit(context)
    }

    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
        commonInit(context) …
Run Code Online (Sandbox Code Playgroud)

android android-custom-view kotlin

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

更改材质滑块拇指大小

所以我在这个项目中使用了 Mat Slider,并在其拇指上显示文本值,但拇指大小对于我的文本来说太小了!我寻找了很多改变拇指大小的方法,但我没有找到任何东西!我不太擅长 CSS,所以我不能乱搞它来尝试让它工作起来!你能帮我么 ?

编辑:

我希望这个词适合拇指 在此输入图像描述

css size angular-material mat-slider

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

minSdkVersion 26 或更高版本,并且仅使用包含 ic_launcher 图标的 mipmap-anydpi

我想知道,当我的新项目minSdkVersion 26(或更高版本)时,我可以安全地删除这些mipmap-*dpi文件夹及其内容ic_launcher图标,然后简单地删除包含矢量图标(和)的文件夹mipmap-anydpi(从 重命名)。mipmap-anydpi-v26ic_launcher.xmlic_launcher_round.xml

Android Studio 屏幕截图

建立一个这样的项目似乎没有问题。这有什么我不知道的潜在问题吗?

android android-min-sdk android-mipmap

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