小编pio*_*543的帖子

Butter Knife - 在Android lib上注入

我使用Gradle在Android Studio上工作.

我的问题是案例标签中的非常量字段.

当我在Android lib中使用Butter Knife时,我收到以下错误:

tutuFragment.java:31: error: attribute value must be constant
    @InjectView(R.id.noContactTV)
Run Code Online (Sandbox Code Playgroud)

有没有人遇到过同样的问题,如果有的话,有解决方案吗?

android gradle android-studio android-gradle-plugin butterknife

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

将Libgdx项目从Eclipse迁移到Android Studio时出错

我正在尝试将我现有的游戏(用libgdx编写)从Eclipse迁移到Android Studio.迁移我的桌面项目后正常工作,但我的Android项目有问题.在android我正在使用Admob广告.

我收到以下错误消息:

在此输入图像描述

如您所见,Android Support Repository已安装 SDK Manager

我的项目结构:

在此输入图像描述

在Project Gradle文件中,我有这个:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
        classpath 'com.android.tools.build:gradle:1.5.0'
        classpath 'org.robovm:robovm-gradle-plugin:1.9.0'
    }
}

allprojects {
    apply plugin: "eclipse"
    apply plugin: "idea"

    version = '1.0'
    ext {
        appName = 'My Game'
        gdxVersion = '1.7.1'
        roboVMVersion = '1.9.0'
        box2DLightsVersion = '1.4'
        ashleyVersion = '1.7.0'
        aiVersion = '1.6.0'
    }

    repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
        maven { url 'https://oss.sonatype.org/content/repositories/releases/' }
    }
}

project(":desktop") {
    apply plugin: …
Run Code Online (Sandbox Code Playgroud)

android gradle libgdx android-studio

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

创建圆形启动器图标

我正在尝试在 Android Studio 2.2 中创建圆形启动器图标,但它们一直是方形的。有人遇到过这种情况么?难道我做错了什么?

在此处输入图片说明

在此处输入图片说明

android assets android-layout android-launcher android-studio

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

如何在android中实现组织结构图

我想知道如何在Android中实现组织结构图?

这是我的布局的架构:

在此输入图像描述

charts android android-layout organizational-chart

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

如何在设置中使用Seekbar?

我想在设置中使用Seekbar选择数字1到10.有没有办法做到这一点?我延长PreferenceActivity了我的设置活动.

正如我从这里发现的那样,但我不知道如何在里面创建Seekbar PreferenceScreen.预先感谢.这是活动

 public class UserSettingActivity extends PreferenceActivity {
    @Override

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);        

         addPreferencesFromResource(R.xml.settings);    }
}
Run Code Online (Sandbox Code Playgroud)

和setting.xml

 <?xml version="1.0" encoding="utf-8"?>

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >

 

    <PreferenceCategory android:title="@string/pref_user_profile" >

        <EditTextPreference

                android:title="@string/pref_user_name"

                android:summary="@string/pref_user_name_summary"

                android:key="prefUsername"/>

    </PreferenceCategory>

     

    <PreferenceCategory android:title="@string/pref_update_setting" >

        <CheckBoxPreference

            android:defaultValue="false"

            android:key="prefSendReport"

            android:summary="@string/pref_send_report_summary"

            android:title="@string/pref_send_report" >

        </CheckBoxPreference>

 

        <ListPreference

            android:key="prefSyncFrequency"

            android:entries="@array/syncFrequency"

            android:summary="@string/pref_sync_frequency_summary"

            android:entryValues="@array/syncFrequencyValues"

            android:title="@string/pref_sync_frequency" />

    </PreferenceCategory>

 

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

android android-preferences android-layout android-seekbar

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

Espresso - 如何将 typeText 切换为英语或其他语言输入模式

我正在使用 Espresso 来实现我的应用程序的自动测试框架。但是在我设计的一些测试用例中,我发现我的测试总是失败,根本原因不在我的测试代码中的功能实现代码。根本原因是在android输入法模式下,有时是中文输入模式,而我的输入文本是英文,那么输入值就会失败。所以我想知道如何将当前的typeText输入法模式从中文切换到英文,或者如何在不手动配置的情况下确保输入法模式为英文?我相信这是一个重要的要求,因为当我们的应用程序支持多种语言时,我们需要此功能在测试期间自动切换到所需的语言。以下是我的代码,如果默认输入模式是英文就没有问题。

    onView(withId(R.id.entryWordInput))
        .perform(typeText(entryWord), closeSoftKeyboard());
    onView(withId(R.id.OkButton))
        .perform(click());
Run Code Online (Sandbox Code Playgroud)

提前致谢。

android ui-testing android-testing android-espresso

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

如何让Kotlin的类型安全构建器在Scala中工作?

Kotlin拥有令人敬畏的类型安全构建器,可以创建像这样的dsl

html {
  head {
    title("The title")
    body {} // compile error
  }
  body {} // fine
}
Run Code Online (Sandbox Code Playgroud)

令人敬畏的是你不能把标签放在无效的地方,比如头部内部的身体,自动完成也能正常工作.

我很感兴趣,如果这可以在Scala中实现.怎么弄?

dsl scala type-safety kotlin

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

ButterKnife错误:找不到符号方法findRequiredViewAsType

我一直在使用ButterKnife.但我有第一次看到的错误,并没有找到解决方案.

错误:

Error:(24, 36) error: cannot find symbol method findRequiredViewAsType(Object,int,String,Class<ImageView>)
Run Code Online (Sandbox Code Playgroud)

我总是像尝试bindView一样

@BindView(R.id.menu_hamburgerIcon)ImageView menuHamburger;

还添加了gradle:

   compile 'com.jakewharton:butterknife:8.0.1'
    apt 'com.jakewharton:butterknife-compiler:8.1.0'
Run Code Online (Sandbox Code Playgroud)

但仍然在ButterKnife的基础上得到这个错误.

android gradle android-gradle-plugin butterknife

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

AndroidTest从命令行运行时失败:app:connectedDebugAndroidTest

我正在使用android spring RestTemplate在我的应用程序上进行REST服务调用.我添加了android Instrumentation测试,其中包括模拟REST服务调用.从android studio运行时,我的所有测试运行正常,但测试无法在终端使用时加载spring mock类

   ./gradlew clean :app:connectedDebugAndroidTest
Run Code Online (Sandbox Code Playgroud)

spring.gradle上的spring测试依赖项

    androidTestCompile("org.springframework:spring-test:3.2.8.RELEASE")
Run Code Online (Sandbox Code Playgroud)

如果我改为compile而不是androidTestCompile,Android测试从终端正常运行.由于我不希望这种依赖我的生产APK任何帮助,赞赏.

这是开始测试时的日志

08-05 00:04:12.585 22274-22302/com.libin.androiduitesting E/TestLoader:找不到类:org.springframework.asm.commons.JSRInlinerAdapter 08-05 00:04:12.587 22274-22302/com.libin .androiduitesting E/TestLoader:找不到类:org.springframework.asm.commons.TryCatchBlockSorter 08-05 00:04:12.593 22274-22302/com.libin.androiduitesting E/TestLoader:找不到类:org.springframework. cglib.transform.AbstractProcessTask 08-05 00:04:12.593 22274-22302/com.libin.androiduitesting E/TestLoader:找不到类:org.springframework.cglib.transform.AbstractTransformTask 08-05 00:04:12.603 22274- 22302/com.libin.androiduitesting E/TestLoader:找不到类:org.springframework.core.convert.support.ConvertingPropertyEditorAdapter 08-05 00:04:12.610 22274-22302/com.libin.androiduitesting E/TestLoader:无法find class:org.springframework.core.io.ResourceEditor 08-05 00:04:12.611 22274-22302/com.libin.androiduitesting E/TestLoader:找不到类:org.spring framework.core.io.support.ResourceArrayPropertyEditor 08-05 00:04:12.617 22274-22302/com.libin.androiduitesting E/TestLoader:找不到类:org.springframework.mock.http.MockHttpInputMessage 08-05 00:04 :12.618 22274-22302/com.libin.androiduitesting E/TestLoader:找不到类:org.springframework.mock.http.MockHttpOutputMessage 08-05 00:04:12.618 22274-22302/com.libin.androiduitesting E/TestLoader:找不到类:org.springframework.mock.http.client.MockClientHttpRequest 08-05 00:04:12.618 22274-22302/com.libin.androiduitesting E/TestLoader:找不到类:org.springframework.mock.http. client.MockClientHttpResponse 08-05 00:04:12.618 22274-22302/com.libin.androiduitesting E/TestLoader:找不到类:org.springframework.mock.jndi.ExpectedLookupTemplate 08-05 00:04:12.619 22274-22302/com.libin.androiduitesting E/TestLoader:找不到类:org.springframework.mock.jndi.SimpleNamingContext 08-05 00:04:12.619 22274-22302/com.libin.androiduitesting …

android spring-test android-espresso spring-android android-instrumentation

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

是否可以在没有预览和用户交互的情况下拍照?

我需要在 flutter 中创建一个在线考试应用程序,我们需要每隔一段时间拍摄用户的照片和视频,并且在执行此操作时我们不想显示相机屏幕。

我尝试使用 flutter 的 Camera 插件,我可以拍照,但我找不到任何方法来在没有相机预览的情况下捕获图像

这是我的代码

import 'dart:async';
import 'dart:io';

import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:path/path.dart' show join;
import 'package:path_provider/path_provider.dart';
import 'package:countdown_flutter/countdown_flutter.dart';

Future<void> main() async {
 WidgetsFlutterBinding.ensureInitialized();

// Obtain a list of the available cameras on the device.
final cameras = await availableCameras();

// Get a specific camera from the list of available cameras.
 final firstCamera = cameras.first;
final frontCam = cameras[1];

runApp(
MaterialApp(
  theme: ThemeData.dark(),
  home: TakePictureScreen(
    // Pass the appropriate camera to the TakePictureScreen widget. …
Run Code Online (Sandbox Code Playgroud)

camera android background flutter flutter-packages

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