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?

Ticherhaz FreePalestine
  • 2,738
  • 4
  • 20
  • 46
kiran
  • 23
  • 3

1 Answers1

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

Gaurav Mall
  • 2,372
  • 1
  • 17
  • 33
  • 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 – kiran Jul 27 '19 at 07:34