小编Rid*_*ary的帖子

自定义文本输入布局

我想应用边框,TextInputLayout如图所示.

现在我已经实现了这样的.

在此输入图像描述

但是,我想如图所示跟随(即标签放在边框内).

在此输入图像描述

我实现的代码EditText如下.

<customviews.MyEditText
             android:id="@+id/email"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:background="@drawable/edittext_border_background"
             android:layout_marginEnd="30dp"
             android:layout_marginStart="30dp"
             android:layout_marginTop="45dp"
             android:gravity="start"
             android:hint="@string/hint_username"
             android:imeOptions="actionNext|actionDone"
             android:inputType="textEmailAddress|text"
             android:padding="10dp"
             android:textColor="@color/primary_text"
             android:textColorHint="@color/secondary_text"
             android:textSize="16sp"
            />
Run Code Online (Sandbox Code Playgroud)

并且,对于边框我已经应用了背景editetext_border_background.xml如下

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:padding="20dp">
    <solid android:color="#FFFFFF"/>
    <corners
        android:bottomRightRadius="0dp"
        android:bottomLeftRadius="0dp"
        android:topLeftRadius="0dp"
        android:topRightRadius="0dp"/>
    <stroke 
        android:width="1dip"
        android:color="@color/primary" />

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

当我尝试应用边框时,TextInputLayout它不会给出预期的输出.

在此输入图像描述

谁能帮我??

android android-textinputlayout android-textinputedittext

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

空的测试套件.浓咖啡

我是自动化测试的新手.我想运行一个特定的测试类,即使我有测试套件,它也会输出为

"客户还没准备好......测试运行开始......测试完成了......空测试套件......"

我搜索过并发现了很多解决方案.但他们都没有为我工作.如果我能得到任何帮助,我将不胜感激.这是测试文件.

 package com.smsbits.veridoc.activity;

@RunWith(AndroidJUnit4.class)
public class TempActivityEspressoTest {
public Resources resources;

@Rule
public ActivityTestRule mActivityRule = new ActivityTestRule<>(TempActivity.class);

@Before
public void init() {
    resources = mActivityRule.getActivity().getResources();
}

@Test
public void testCheckInputs() {
    onView(withId(R.id.btnchange)).perform(click());
    onView(withId(R.id.tvrandom)).check(ViewAssertions.matches(withText("hello")));
}} 
Run Code Online (Sandbox Code Playgroud)

这是我的gradle文件.

android {  
... 
packagingOptions {
    ...
    exclude 'META-INF/XXX'
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/DEPENDENCIES'
}

defaultConfig {
    ...
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

testOptions {
    unitTests.returnDefaultValues = true
}

configurations.all {
    resolutionStrategy.force 'com.android.support:support-annotations:23.0.1'
}

 }

dependencies{ …
Run Code Online (Sandbox Code Playgroud)

android ui-testing ui-automation junit-runner android-espresso

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