小编Edg*_*des的帖子

如何删除EditText指标下方的下划线?

最近我不得不更改EditText指示器颜色,在这之后,一条奇怪的线开始出现在指示器下方.我怎么能删除它?我所做的代码如下.

在此输入图像描述

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:app="http://schemas.android.com/apk/res-auto"
                xmlns:card_view="http://schemas.android.com/apk/res-auto"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:background="#4FB6E1">

    <br.com.edsilfer.kiwi.loading.CircularProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        app:colorLine="#4e2972"/>

    <pl.droidsonroids.gif.GifTextView
        android:id="@+id/flying_charizard"
        android:layout_width="100dip"
        android:layout_height="70dip"
        android:layout_above="@+id/login_cluster"
        android:layout_margin="15dip"
        android:background="@drawable/flying_charizard"/>

    <android.support.v7.widget.CardView
        android:id="@+id/login_cluster"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_marginLeft="15dip"
        android:layout_marginRight="15dip"
        android:elevation="4dip"
        card_view:cardUseCompatPadding="true">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:paddingBottom="10dip"
            android:paddingLeft="10dip"
            android:paddingRight="10dip">

            <include layout="@layout/rsc_util_remove_act_edittext_focus"/>

            <EditText
                android:id="@+id/email"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="E-mail"
                android:imeOptions="actionNext"
                android:inputType="text"
                android:textColor="@color/textSecondary"
                android:textColorHint="@color/textSecondary"
                android:theme="@style/CustomEditText"/>

            <EditText
                android:id="@+id/password"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dip"
                android:hint="Password"
                android:imeOptions="actionGo"
                android:inputType="textPassword"
                android:fontFamily="sans-serif"
                android:textColor="@color/textSecondary"
                android:textColorHint="@color/textSecondary"
                android:theme="@style/CustomEditText"/>


            <com.gc.materialdesign.views.ButtonRectangle
                android:id="@+id/login"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="15dip"
                android:background="@color/textSecondary"
                android:text="@string/act_login_login"/>

            <com.gc.materialdesign.views.ButtonFlat
                android:id="@+id/register"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="10dip"
                android:background="@color/textSecondary"
                android:text="@string/act_login_create_account"/>

            <com.gc.materialdesign.views.ButtonFlat
                android:id="@+id/forgotPassword"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

android

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

如何解决Firebase API初始化失败(Android + Firebase)

我最近需要在我的项目中使用Google GCM.从它的网站上说:

Firebase云消息传递(FCM)是GCM的新版本.它继承了可靠且可扩展的GCM基础架构以及新功能!请参阅常见问题以了解更多信息 如果要在新应用程序中集成消息传递,请从FCM开始.强烈建议GCM用户升级到FCM,以便从当前和未来的新FCM功能中受益.

为了设置新的Firebase应用程序,我按照官方网站提供的说明进行了以下操作:

  1. 在Web控制台中创建了一个新的Firebase应用程序并从那里获得了我的json - 在提供了我的应用程序的正确包之后;
  2. 在顶级项目的gradle文件中,我添加classpath 'com.google.gms:google-services:3.0.0'了依赖项部分;
  3. 在我的模块的gradle文件中,我添加了:compile 'com.google.firebase:firebase-core:9.0.0' compile 'com.google.firebase:firebase-messaging:9.0.0'在最后一行中,我添加了:apply plugin: 'com.google.gms.google-services';

Full Gradle文件如下:

顶级gradle文件:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

模块的gradle文件:

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    dexOptions {
        javaMaxHeapSize …
Run Code Online (Sandbox Code Playgroud)

google-app-engine android firebase android-gradle-plugin

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

如何使用gradle bintray插件将模块上传到JCenter?

我很抱歉,如果我太愚蠢,但我无法使其工作......我在AS中有一个我想要上传到JCenter的Android模块项目 - 使用JFrog的 gradle bintray插件.我按照教程在bintray上创建了存储库,最后我得到了模块的以下build.gradle:

apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

bintray {
    user = properties.getProperty('bintray.user')
    key = properties.getProperty('bintray.apikey')

    configurations = ['published', 'archives']

    dryRun = false
    publish = true

    pkg {
        repo = 'maven'
        name = 'custom-searchable'

        desc = 'This repository contains a library that aims to provide a custom searchable interface for android applications'

        websiteUrl = 'https://github.com/...'
        issueTrackerUrl = 'https://github.com/.../issues'
        vcsUrl = 'https://github.com/....git'

        licenses = ['The Apache …
Run Code Online (Sandbox Code Playgroud)

android maven bintray android-studio jcenter

8
推荐指数
1
解决办法
3239
查看次数

如何解决:"错误:找不到符号类......"将Java类转换为Kotlin后?

我试图从Kotlin开始,将我的项目的一些Java类转换为Kotlin并创建一个混合的Java/Kotlin项目.为了配置环境,我做了以下事情:

  1. 下载最新版本的Kotlin插件(1.0.2);
  2. 在顶级gradle.plugin我添加了:classpath "org.jetbrains.kotlin:kotlin-android-extensions:1.0.2"在依赖项部分;
  3. 在我的模块的gradle插件中,我添加了:compile "org.jetbrains.kotlin:kotlin-stdlib:1.0.2"在dependencies部分;
  4. 我选择了我想要转换为kotlin的POJO类,从菜单代码 - >将Java文件转换为Kotlin文件中选择;
  5. 之后,导入转换后的类的所有Java类开始显示:error: cannot find symbol class Chat.下面是原始类,转换后的类和日志:

原始Java类:

package br.com.gogame.model;

import com.google.gson.Gson;
import com.orm.SugarRecord;
import com.orm.dsl.Ignore;

import java.io.Serializable;
import java.util.List;

import br.com.gogame.model.enums.ChatType;

/**
 * Created by edgar on 11-Apr-16.
 */
public class Chat extends SugarRecord implements Serializable {

    private String title;
    private String thumbnail;
    private ChatType chat_type;
    private long chat_id;
    private int num_of_members;
    private long user_id;
    @Ignore
    private List<Long> users;

    public Chat() {
    }

    public String …
Run Code Online (Sandbox Code Playgroud)

android kotlin

8
推荐指数
1
解决办法
4829
查看次数

模拟对象仍在调用方法(Mockito + Kotlin)

我正在尝试测试这个类:

class LoginPresenter(val mPostman: Postman) : ContractLoginPresenter, Validator.ValidationListener {

    private var view: ContractLoginView? = null

    override fun setView(_view: BaseView) {
        view = _view as ContractLoginView
    }

    override fun getValidationListener(): Validator.ValidationListener {
        return this
    }

    override fun onValidationSucceeded() {
        view!!.getContext().showCircularProgressBar()
        mPostman.login(view!!.getUsername(), view!!.getPassword())
    }
Run Code Online (Sandbox Code Playgroud)

为此,我创建了这个测试类:

@RunWith(PowerMockRunner::class)
@PrepareForTest(App::class)
class TestLoginPresenter {

    var mockedPostman = mock(Postman::class.java)
    var mockedComponent = mock(MainComponent::class.java)
    var mockedView = mock(ContractLoginView::class.java)
    var mockedContext = mock(AppCompatActivity::class.java)

    var loginPresenter: LoginPresenter? = null

    @Before
    fun setUp() {
        PowerMockito.mockStatic(App::class.java)
        `when`(App.component).thenReturn(mockedComponent)
        loginPresenter = LoginPresenter(mockedPostman)
        loginPresenter!!.setView(mockedView)
        `when`(mockedView.getContext()).thenReturn(mockedContext) …
Run Code Online (Sandbox Code Playgroud)

android unit-testing mockito kotlin powermockito

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

Kotlin高阶函数如何工作?

我正在努力理解高阶函数以及如何使用Kotlin将函数作为参数传递给其他函数.我有一个基本的例子,我想填补:

fun addOnSearchGameResultListener(
            activity: AppCompatActivity,
            releaseThread: () -> Unit,
            showNoResultsFoundMessage: () -> Unit,
            updateSearchResults: (result: List<Game>) -> Unit) {
        var event0017Handler: TaskExecutor = object : TaskExecutor {
            override fun executeOnSuccessTask(response: JSONObject) {
                async() {
                    uiThread {
                        try {
                            releaseThread()
                            mLoaderManager.hideIndeterminateProgressBar(activity)
                            val result = mJSONParser.getGamesByGameKey(response)
                            Log.i(GameController::class.simpleName, "response: ${result.toString()}")
                            updateSearchResults(result)
                        } catch (e: JSONException) {
                            showNoResultsFoundMessage()
                        }
                    }
                }
            }

            override fun executeOnErrorTask(payload: JSONObject) {
                releaseThread()
                mNotificationManager.showErrorPopUp(activity, payload.getString("data"))
            }
        }
        NotificationCenter.RegistrationCenter.registerForEvent(EventCatalog.e0017, event0017Handler)
    }
Run Code Online (Sandbox Code Playgroud)

我用这种方式调用上面的方法:

mGameService.addOnSearchGameResultListener(
            this,
            releaseThread(),
            showNoResultsFoundMessage(),
            updateSearchResults(null)
    )
Run Code Online (Sandbox Code Playgroud)

updateSearchResults(null) …

android kotlin

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

如何在GitHub markdown中垂直对齐元素?

如何垂直对齐下面的图像和图像的文字?

在此处输入图片说明

我在降价中添加它的方式是:

<a name="version"></a>[ ![Download](https://api.bintray.com/packages/edsilfer/maven/search-interface/images/download.svg) ](https://bintray.com/edsilfer/maven/search-interface/_latestVersion) - **MIN API VERSION: 16**

markdown github github-flavored-markdown

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