2017-06-21 10 views
-3

私はAndroid開発を初めて使い、最近Androidスタジオでアプリを作り始めました。EditTextのデザインを変更しました

EditTextコンポーネントの外観を変更することはできますか?ここで

は、私は新しいものを作成したとき、私は取得していますデフォルトの外観です:

http://imgur.com/eFWNIJb

そして、ここでは、私が達成しようとしているものです:

http://imgur.com/uwaOBi7

ありがとうございましたあらかじめ。

EDIT:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.0" 
    defaultConfig { 
     applicationId "com.fivecore.nuqliati" 
     minSdkVersion 15 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:26.+' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    testCompile 'junit:junit:4.12' 
} 
+0

であるあなたは、[のEditText標識フロート](https://github.com/wrapp-archive/floatlabelededittext)と呼ばれるこの単純なライブラリを試すことができます。 –

答えて

0

Androidの浮動ラベルは、のEditTextの上に浮いラベルを表示するには、Androidデザイン・サポート・ライブラリで導入されました。あなたのXMLレイアウトファイルにこのコードを追加

<android.support.design.widget.TextInputLayout 
android:layout_width="match_parent" 
android:layout_height="wrap_content"> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="Email Address" /> 

</android.support.design.widget.TextInputLayout> 

より

このライブラリーに私の友人をコンパイル

compile 'com.android.support:design:26.+'' 

より多くの情報のための設計アンドロイドのこのタイプのためにここにandroidhive

+0

ありがとう、私はまだライブラリをコンパイルする際に問題があります、どのように正確にこれを行うのですか? –

+0

あなたのグラデルファイルを貼り付けてください、またはあなたのコンパイルを貼り付けてください。com.android.support:appcompat-v--- –

+0

Woopsを使っていますが、うまくいかない、どこにグラデルファイルを貼り付けるべきですか? –

0

をクリックしてライブラリを提供あなたのedittextの外観を変えることができます

はちょうど

<android.support.design.widget.TextInputLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

<EditText 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:hint="Email" 
    android:textColorHint="#4233FF" /> 

いけない

compile 'com.android.support:design:25.3.1' 
0

ザッツは、Android浮動ラベルと呼ばれますが、この使用ライブラリ

ためTextInputLayoutビューを使用する必要がありますをGradleのために、この依存関係を追加するのを忘れ、こののTextViewを使用します

コンパイル 'com.android.support:design:25.3.1'

とビューのレイアウトでこれを使用することができますが

<android.support.design.widget.TextInputLayout 
android:layout_width="match_parent" 
android:layout_height="wrap_content"> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="First Name" 
     android:id="@+id/fname" /> 

</android.support.design.widget.TextInputLayout> 
関連する問題