2

enter image description here

I am trying to get a glow effect like the background for edittext

I tried doing it but the background is not as much effective as the image

<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <solid android:color="#68F30606"/> <corners android:radius="10dp" /> </shape> </item> <item android:left="1.7dp" android:right="1.7dp" android:top="1.7dp" android:bottom="1.7dp"> <shape android:shape="rectangle"> <solid android:color="@android:color/white"/> <corners android:radius="10dp" /> </shape> </item> </layer-list> 

Can someone help me to solve this mystery?

3
  • This glow used to be in old android phones. Are you sure you want to add it? Commented Jul 27, 2019 at 5:24
  • @TaraIordanov yes I want it Commented Jul 27, 2019 at 5:42
  • well, check my answer if it helps you Commented Jul 27, 2019 at 5:50

1 Answer 1

0

Then you will need to use the old-technique(kind of) of 9-Patch Drawing. I used to do it too. Examples are scarce because they are big, but there is documentation.

Documentation: https://developer.android.com/studio/write/draw9patch.

Also, if this helps you can check this too: Outer glow in edittext

To use the 9-Patch images in Xml to this (remember this is after you have created the 9-Patch Images):

  1. Reference the drawable with the name but don't include .9.png (auto-complete in eclipse will take care of this)

  2. Make sure you only have 1 image under the main /drawable folder (not a version for each dpi folder)

  3. The image must be specified using :background, not :src (this got me stuck for a while)

    android:background="@drawable/splash_logo"

  4. Make sure the image and layout that contains it are using:

    android:layout_width="fill_parent"
    android:layout_height="fill_parent"

Credit To: Creating & Using 9-patch images in Android

Also, check this website out, it contains a lot of useful examples that the documentation doesn't provide: https://tekeye.uk/android/examples/ui/android-9-patch-image-files

Sign up to request clarification or add additional context in comments.

1 Comment

lordanov Now I know that 9 patch tools will help, but how does 9 patch tool can be applicable for an XML file. I mean drawable I mentioned above or I should create an image and make text appear on edit text

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.