Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8019771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:29:29+00:00 2026-06-04T21:29:29+00:00

I try to make a rouned EditText.It display well in the Graphical layout in

  • 0

I try to make a rouned EditText.It display well in the Graphical layout in main.xml. But it is still square when i launch the AVD.Here is the code:

<EditText
        android:id="@+id/et"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:padding="5dp"
        android:hint="Enter a #hashtag or keyword"
        android:textColor="#000000"
        android:drawableLeft="@drawable/magnifier"
        android:background="@drawable/rounded_edittext"
        android:textSize="16dp" >
        <requestFocus />
    </EditText> 
<!-- res/drawable/rounded_edittext.xml -->     <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:shape="rectangle" >
<solid android:color="#FFFFFF" />
<corners
    android:bottomLeftRadius="15dp"
    android:bottomRightRadius="15dp"
    android:topLeftRadius="15dp"
    android:topRightRadius="15dp" />

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:29:32+00:00Added an answer on June 4, 2026 at 9:29 pm

    This a rounded edit text that change also behavour on clik states, Simply use thes xml

    <?xml version="1.0" encoding="utf-8"?>
    <!-- res/drawable/rounded_edittext_states.xml -->
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item 
         android:state_pressed="true" 
         android:state_enabled="true"
            android:drawable="@drawable/rounded_focused" />
        <item 
         android:state_focused="true" 
         android:state_enabled="true"
            android:drawable="@drawable/rounded_focused" />
        <item 
         android:state_enabled="true"
            android:drawable="@drawable/rounded_edittext" />
    </selector>
    

    Normal rounded edittext:

    <?xml version="1.0" encoding="utf-8"?>
    <!--  res/drawable/rounded_edittext.xml -->
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" android:padding="10dp">
     <solid android:color="#FFFFFF"/>
        <corners
         android:bottomRightRadius="15dp"
         android:bottomLeftRadius="15dp"
      android:topLeftRadius="15dp"
      android:topRightRadius="15dp"/>
    </shape>
    

    Pressed,Focused edittext

    <?xml version="1.0" encoding="utf-8"?>
    <!-- res/drawable/rounded_edittext_focused.xml -->
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" android:padding="10dp">
     <solid android:color="#FFFFFF"/>
     <stroke android:width="2dp" android:color="#FF0000" />
        <corners
         android:bottomRightRadius="15dp"
         android:bottomLeftRadius="15dp"
      android:topLeftRadius="15dp"
      android:topRightRadius="15dp"/>
    </shape>
    

    And… now, the EditText should look like:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    <EditText  
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="@string/hello"
        android:background="@drawable/rounded_edittext_states"
        android:padding="5dip"/>
    </LinearLayout>
    

    i used this layout to test it for and it works for me even with multiple round edittext:

    this is the layout i use

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
    
        <EditText
            android:id="@+id/et"
            android:layout_width="300dp"
            android:layout_height="wrap_content"
            android:background="@drawable/rounded_edittext"
            android:drawableLeft="@drawable/ic_launcher"
            android:hint="Enter a Login"
            android:textColor="#000000"
            android:textSize="16dp"
            android:padding="5dp">
            <requestFocus />
            </EditText>
    
            <EditText
                android:id="@+id/et2"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_below="@+id/et"
                android:layout_marginTop="14dp"
                android:background="@drawable/rounded_edittext"
                android:drawableLeft="@drawable/ic_launcher"
                android:ems="10"
                android:hint="Enter a Password"
                android:padding="5dp"
                android:textColor="#000000"
                android:textSize="16dp" />
    
    </RelativeLayout>
    

    and this is a screen capture of the result on emulator:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to make an animation with an image in my view but it
I try to make have an EventListener in ItemRenderer but its not working. How
I try to make a displaying list with onmouseover() with some links but they
I will try to make this as clear as I can, but if you
I've lost alot of time to try to make this work, but with no
Databinding in WPF is great, but the moment you try make things more complex
I want to interrupt a thread1 from another thread2 but when I try make
I try to make a registration form. When user post the fields, i check
I try to make Ext.Data.Store working... With a normal proxy it works great: var
I try to make an Android application which communicates with a non-standard ISO15693 (NFC-V)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.