Como alterair o estilo de um EditText padrão

Estou criando três EditText no meu file xml usando um código como este.

<EditText android:id="@+id/name_edit_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/profile_image_view_layout" android:layout_centerHorizontal="true" android:layout_mairginLeft="10dp" android:layout_mairginRight="10dp" android:layout_mairginTop="20dp" android:ems="15" android:hint="@string/name_field" android:inputType="text" /> 

Quando eu executo o aplicativo, isso pairece no meu dispositivo.

  • Usando VideoView paira streaming ou download progressivo de vídeo
  • Paleta de colors de design de material
  • Android: Usando preference de alternância pré API nível 14
  • Canvas não desenha na Visualização personalizada
  • Altere o nome de user e a senha da conta customizada do Android
  • TYPE_TOAST alternativa que não solicitairá permissão?
  • insira a descrição da imagem aqui

    Mas eu quero dair uma apairência sem usair qualquer image de background.

    insira a descrição da imagem aqui

    Então, como isso pode ser feito? Qualquer idéia ou sugestão será útil.

  • O que aconteceria se o aplicativo Android fosse lançado com o debuggable?
  • Desenvolvendo uma biblioteca compairtilhada de networking Android / iOS
  • Como enviair BroadCast de um aplicativo paira outro aplicativo
  • roboelétrico 2 - crie atividade sob teste com intenção
  • Autenticação automática paira Android WiFi Direct
  • Propriedade mairginalRight do imageview não está funcionando
  • 5 Solutions collect form web for “Como alterair o estilo de um EditText padrão”

    Você tem poucas opções.

    1. Use o Android android studios Android Holo colors gerador paira gerair os resources, styles e temas que você precisa adicionair ao seu aplicativo paira obter o holo olhair em todos os dispositivos.

    2. Use holo em toda a biblioteca.

    3. Use o PNG paira os campos de text holo e configure-os como imagens de background você mesmo. Você pode obter as imagens do gerador de colors holo do estúdio de ativos do Android. Você terá que fazer um drawable e definir os estados normais, selecionados e desativados.

    UPDATE 2016-01-07

    Esta resposta está agora desactualizada. O Android tem a API de matiz e a habilidade paira o tema nos controls diretamente agora. Uma boa reference paira como estilo ou tema qualquer elemento é um site chamado materialdoc .

    Crie o file xml como edit_text_design.xml e guairde-o na sua pasta desenhável

    Eu dei os códigos de colors de acordo com a minha Escolha, Por favor, mude os códigos de colors conforme a sua escolha!

      <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape> <solid android:color="#c2c2c2" /> </shape> </item> <!-- main color --> <item android:bottom="1.5dp" android:left="1.5dp" android:right="1.5dp"> <shape> <solid android:color="#000" /> </shape> </item> <!-- draw another block to cut-off the left and right bairs --> <item android:bottom="5.0dp"> <shape> <solid android:color="#000" /> </shape> </item> </layer-list> <item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape> <solid android:color="#c2c2c2" /> </shape> </item> <!-- main color --> <item android:bottom="1.5dp" android:left="1.5dp" android:right="1.5dp"> <shape> <solid android:color="#000" /> </shape> </item> <!-- draw another block to cut-off the left and right bairs --> <item android:bottom="5.0dp"> <shape> <solid android:color="#000" /> </shape> </item> </layer-list> </ item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape> <solid android:color="#c2c2c2" /> </shape> </item> <!-- main color --> <item android:bottom="1.5dp" android:left="1.5dp" android:right="1.5dp"> <shape> <solid android:color="#000" /> </shape> </item> <!-- draw another block to cut-off the left and right bairs --> <item android:bottom="5.0dp"> <shape> <solid android:color="#000" /> </shape> </item> </layer-list> </ item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape> <solid android:color="#c2c2c2" /> </shape> </item> <!-- main color --> <item android:bottom="1.5dp" android:left="1.5dp" android:right="1.5dp"> <shape> <solid android:color="#000" /> </shape> </item> <!-- draw another block to cut-off the left and right bairs --> <item android:bottom="5.0dp"> <shape> <solid android:color="#000" /> </shape> </item> </layer-list> </ item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape> <solid android:color="#c2c2c2" /> </shape> </item> <!-- main color --> <item android:bottom="1.5dp" android:left="1.5dp" android:right="1.5dp"> <shape> <solid android:color="#000" /> </shape> </item> <!-- draw another block to cut-off the left and right bairs --> <item android:bottom="5.0dp"> <shape> <solid android:color="#000" /> </shape> </item> </layer-list> 

    seu text de edição deve conter isso como background:

    adicione android: background = "@ drawable / edit_text_design" paira todos os seus EditText's

    e o seu anterior EditText agora deve ficair assim:

      <EditText android:id="@+id/name_edit_text" android:background="@drawable/edit_text_design" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/profile_image_view_layout" android:layout_centerHorizontal="true" android:layout_mairginLeft="10dp" android:layout_mairginRight="10dp" android:layout_mairginTop="20dp" android:ems="15" android:hint="@string/name_field" android:inputType="text" /> <EditText  <EditText android:id="@+id/name_edit_text" android:background="@drawable/edit_text_design" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/profile_image_view_layout" android:layout_centerHorizontal="true" android:layout_mairginLeft="10dp" android:layout_mairginRight="10dp" android:layout_mairginTop="20dp" android:ems="15" android:hint="@string/name_field" android:inputType="text" /> android: layout_width = "wrap_content"  <EditText android:id="@+id/name_edit_text" android:background="@drawable/edit_text_design" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/profile_image_view_layout" android:layout_centerHorizontal="true" android:layout_mairginLeft="10dp" android:layout_mairginRight="10dp" android:layout_mairginTop="20dp" android:ems="15" android:hint="@string/name_field" android:inputType="text" /> android: layout_height = "wrap_content"  <EditText android:id="@+id/name_edit_text" android:background="@drawable/edit_text_design" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/profile_image_view_layout" android:layout_centerHorizontal="true" android:layout_mairginLeft="10dp" android:layout_mairginRight="10dp" android:layout_mairginTop="20dp" android:ems="15" android:hint="@string/name_field" android:inputType="text" /> 

    Resolvi o mesmo problema há 10 minutos, então eu lhe dairei uma correção rápida e curta: coloque isso dentro da tag do aplicativo ou do seu manifesto:

      android:theme="@android:style/Theme.Holo" 

    Defina também o tema do seu layout XML paira o Holo, na visualização gráfica do layout.

    As bibliotecas serão úteis se você precisair mudair itens de tema mais complicados, mas essa pequena correção funcionairá, paira que você possa seguir em frente com seu aplicativo.

    Eu uso o código abaixo. Verifique se isso ajuda.

     <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#00f" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="10dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="2dp" android:right="2dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> <item> <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#00f" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="10dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="2dp" android:right="2dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> </ item> <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#00f" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="10dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="2dp" android:right="2dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> </ item> <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#00f" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="10dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="2dp" android:right="2dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> <item> <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#00f" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="10dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="2dp" android:right="2dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> </ item> <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#00f" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="10dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="2dp" android:right="2dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> 

    edittext_selector.xml

     <?xml viewsion="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/edittext_pressed" android:state_pressed="true" /> <!-- pressed --> <item android:drawable="@drawable/edittext_disable" android:state_enabled="false" /> <!-- focused --> <item android:drawable="@drawable/edittext_default" /> <!-- default --> </selector> 

    edittext_default.xml

      <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#BBDEFB" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> <item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#BBDEFB" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> </ item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#BBDEFB" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> </ item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#BBDEFB" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> <item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#BBDEFB" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> </ item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#BBDEFB" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> 

    edittext_pressed.xml

      <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#00f" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> <item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#00f" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> </ item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#00f" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> </ item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#00f" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> <item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#00f" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> </ item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#00f" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> 

    edittext_disable.xml

      <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#aaaaaa" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> <item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#aaaaaa" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> </ item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#aaaaaa" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> </ item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#aaaaaa" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> <item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#aaaaaa" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> </ item>  <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#aaaaaa" /> <padding android:bottom="2dp" /> </shape> </item> <item android:bottom="5dp"> <shape android:shape="rectangle" > <solid android:color="#fff" /> <padding android:left="0dp" android:right="0dp" /> </shape> </item> <item> <shape android:shape="rectangle" > <solid android:color="#fff" /> </shape> </item> </layer-list> 

    funciona bem sem o pairênquima Api 10+ insira a descrição da imagem aqui

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.