-1

I have tried many methods but my issues is not solved.I am facing the issue in changing the colour for the border of the button and underline in the editText. In changing the colour of the button the background colour should be transparent but the border of the button should be visible in white colour. EditText underline colour is should be in white. How to create the design like below image.enter image description here

Please help me how to design Login with Facebook button border is in white colour should be visible and also edittext underline colour should be in white.

Prabha Karan
  • 1,309
  • 3
  • 17
  • 35

3 Answers3

2

Try this:

For Edittext underline color use:

 <EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="20dp"
    android:layout_marginTop="20dp"
    android:backgroundTint="@android:color/white"
    android:hint="Username"
    android:paddingLeft="20dp"
    android:textColorHint="@android:color/white" />

For Button background:

drawable/background.xml:

 <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <!--stroke width and color-->
    <stroke
        android:width="2dp"
        android:color="@android:color/white" />

    <!-- corner radius-->
    <corners
        android:radius="0dp" />
</shape>

And in layout:

 <Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/background"
    android:text="Login With Facebook"
    android:textColor="@android:color/white" />

EDIT

backgroungTint will not work on Pre lollipop devices

try using this:

 <android.support.v7.widget.AppCompatEditText
    android:id="@+id/my_appcompat_imageview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:backgroundTint="@android:color/white"
    android:hint="Username"
    android:textColorHint="@android:color/white"
    android:tint="@android:color/white" />

output:

enter image description here

rafsanahmad007
  • 23,683
  • 6
  • 47
  • 62
1

Border for Button: You can set a drawable shape as background of button to change it's border color. See this

Change EditText UnderLine: You can add colorHighlight and colorNormal to your BaseTheme. It will change the underline color of editText. See this.

Hope this helps.

Community
  • 1
  • 1
tahsinRupam
  • 6,325
  • 1
  • 18
  • 34
1

Just make button_bg.xml file in drawable and put given code below

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item>
    <shape android:shape="rectangle">

        <solid android:color="#30055fab" />
        <stroke android:width="2dp" android:color="#FFFFFF" />
        <corners android:radius="0dp" />
    </shape>
</item>

and define button background as above created xml file

<Button
        android:id="@+id/btnLogin"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/_10dp"
        android:background="@drawable/button_bg"
        android:text="Log in"
        android:textColor="@android:color/white" />

To add line in editext try this code

 <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/_10dp"

        android:textColorHint="@android:color/white"
        app:hintEnabled="true">

        <android.support.design.widget.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/transparent"
            android:hint="@string/password"
            android:inputType="textPassword"
            android:padding="@dimen/_10dp"
            android:textColor="@android:color/white"
            android:textColorHint="@android:color/white" />

        <view
            android:layout_width="match_parent"
            android:background="@android:color/white"
            android:layout_height="1dp"/>
    </android.support.design.widget.TextInputLayout>
Nikhil Sharma
  • 593
  • 7
  • 23