小编ema*_*272的帖子

将backgroundtint应用于API 19的背景drawable

背景色调在API 23上正确应用,但在API 19上未正确应用.如何获得API 19及更低版本的drawable着色?

                    <Button
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:id="@+id/AbResetBtn"
                    android:background="@android:drawable/stat_notify_sync"
                    android:backgroundTint="@color/button_material_light" />
Run Code Online (Sandbox Code Playgroud)

当然,我的Activity扩展了AppCompatActivity.

android tint backwards-compatibility drawable

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

如何获取 ConstraintLayout 内视图的实际宽度、高度、顶部、底部等?

当 a 内的视图ConstraintLayout设置为android:layout_width="0dp"android:layout_height="0dp"以便应用app:layout_constraintLeft_toLeftOf和 中设置的约束时,方法getWidth()getMeasuredWidth()getHeight()等返回 0。如何获取此类视图的实际宽度、高度等?

这是示例代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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:id="@+id/scMainFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintVertical_chainStyle="spread_inside"
app:layout_optimizationLevel="chains"
tools:context=".MainActivity"
tools:layout_behavior="@string/appbar_scrolling_view_behavior">

<TextView
    android:id="@+id/textView10"
    android:layout_width="14dp"
    android:layout_height="0dp"
    android:gravity="center_vertical"
    android:text="A"
    android:background="#FF0000"
    app:layout_constraintTop_toTopOf="@+id/SCFrame"
    app:layout_constraintRight_toLeftOf="@+id/SCFrame"
    app:layout_constraintBottom_toTopOf="@+id/textView11"
    />

<TextView
    android:id="@+id/textView11"
    android:layout_width="14dp"
    android:layout_height="0dp"
    android:gravity="center_vertical"
    android:text="B"
    android:background="#FF0000"
    app:layout_constraintTop_toBottomOf="@+id/textView10"
    app:layout_constraintRight_toLeftOf="@+id/SCFrame"
    app:layout_constraintBottom_toBottomOf="@+id/SCFrame"
    />

<be.ema.sclibrary.SCConstraintLayout
    android:id="@+id/SCFrame"
    android:layout_width="150dp"
    android:layout_height="wrap_content"
    android:layout_marginLeft="14dp"
    android:background="#0000FF"
    app:layout_constraintLeft_toRightOf="@+id/textView10"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    >

    <TextView
        android:id="@+id/A1"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:text="this is A1"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintRight_toLeftOf="@+id/A2"
        app:layout_constraintBottom_toTopOf="@+id/B1" …
Run Code Online (Sandbox Code Playgroud)

android-constraintlayout

6
推荐指数
0
解决办法
1082
查看次数

Android Studio 3:如何将源代码库导入项目

build.gradleapp文件夹中包含以下代码:

dependencies {
    ...
    compile project(':sclibrary')
}
Run Code Online (Sandbox Code Playgroud)

settings.gradle项目文件夹文件包含:

include ':app', ':sclibrary'
project(':sclibrary').projectDir = new File(rootProject.projectDir, '../sclibrary4')
Run Code Online (Sandbox Code Playgroud)

当我同步我的项目时,我收到一条错误,上面写着"缺少依赖项:无法找到带有Gradle路径的模块":sclibrary'(模块'app'需要.)"

编辑:

"sclibrary4"位于文件夹中,作为"sc"和"ScLite"应用程序; 这些应用程序使用位于"sclibrary4"中的公共代码 文件结构

当我尝试使用"文件>新建>导入模块"命令时,我收到错误消息"此位置已导入"但是

在此输入图像描述

在此输入图像描述

android gradle build.gradle android-gradle-plugin

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

当 style=slides 时禁用 amp-carousel 中的控件

我想隐藏当放大器轮播的类型为“幻灯片”时显示的“上一个”和“下一个”控件。我还没有找到任何有关如何自定义“控件”属性的文档。

html carousel amp-html

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

如何在多个应用程序共有的库中包含的方法中获取应用程序的VERSION_NAME?

我开发了一个库来共享两个应用程序共有的代码.其中一个共享方法旨在显示应用程序的VERSION_NAME.此VERSION_NAME已设置在build.gradle每个应用程序的文件中.当我BuildConfig.VERSION_NAME在库方法的代码中使用时,它返回库的版本名称.如何将变量集引用到应用程序gradle文件中?

android buildconfig build.gradle

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

如何返回IAsyncOperation &lt;TReturn&gt;结果?

我想异步执行CPU密集型工作。我想使用这样的代码:

   ....
   updateGUIObj = await setSelectedGUICellValueAsync(arg1, arg2, cssId, isInitializeCbxChecked);
   ....


   public IAsyncOperation<UpdateGUIObj> setSelectedGUICellValueAsync(int arg1, int arg2, String cssId, bool isInitializeCbxChecked)
   {
        updateGUIObj = new UpdateGUIObj();

        ....  // compute intensive work setting "updateGUIObj" 

        return ?????;
    }
Run Code Online (Sandbox Code Playgroud)

我应该如何写以上return声明?

c# asynchronous

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