1

I am trying to customize the UI of application in Basi4Application. Its been just 3 days am using it. So I need help with customization of UI. So far I have made this changes and still learning. Can anyone point me to any tutorials or website which talks about customization of UI in Basic4Android. enter image description here The Username Edittext is by default displayed like this want to make look like something like this.Please refere below image. enter image description here Someone please help me . Thanks in advance.

Mayur
  • 789
  • 10
  • 37

5 Answers5

2

Create xml file in drawable folder-

rounded_corner.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- 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="3dp"
        android:bottomRightRadius="3dp"
        android:topLeftRadius="3dp"
        android:topRightRadius="3dp" />
    <stroke
          android:width="2dp"
        android:color="#4D4D4D"
        ></stroke>

</shape>

& in your layout code-

<TextView
            android:id="@+id/Name"
            android:layout_width="fill_parent"
            android:layout_height="40dp"  
            android:background="@drawable/rounded_corner"
             />
yuva ツ
  • 3,707
  • 9
  • 50
  • 78
0

try below code:-

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <solid android:color="@color/white_lite" />

<stroke android:width="1dp"
    android:color="@color/purple_dark"/>

</shape>

or

<?xml version="1.0" encoding="utf-8"?>
<!-- res/drawable/rounded_edittext.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:padding="10dp"
    android:shape="rectangle" >

    <solid android:color="#60FFFFFF" />

    <stroke
        android:width="2dp"
        android:color="#1c6aaa" />

    <corners
        android:bottomLeftRadius="10dp"
        android:bottomRightRadius="10dp"
        android:topLeftRadius="10dp"
        android:topRightRadius="10dp" />

</shape>
duggu
  • 37,851
  • 12
  • 116
  • 113
0

rounded_corner.xml

  <?xml version="1.0" encoding="utf-8"?>
     <shape
       xmlns:android="http://schemas.android.com/apk/res/android"
      android:shape="rectangle">

  <!-- view background color -->
 <solid
    android:color="#a9c5ac" >
</solid>

<!-- view border color and width -->
<stroke
    android:width="3dp"
    android:color="#1c1b20" >
</stroke>

<!-- If you want to add some padding -->
<padding
    android:left="4dp"
    android:top="4dp"
    android:right="4dp"
    android:bottom="4dp"    >
</padding>

<!-- Here is the corner radius -->
<corners
    android:radius="10dp"   >
</corners>
</shape>

And keep this drawable as background for the view to which you want to keep rounded corner border. Let’s keep it for a LinearLayout

    <TextView android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Name"
        android:gravity="center"
        android:padding="5dp"/>

</LinearLayout>
  • I am not working with Eclipse. I am using Basic4Android Application to make the application. How this be done in that application. – Mayur Apr 11 '14 at 07:43
0

The default Edit text looks different in different phones and emulators. Eg: Try older emulators, you will get nice round rectangle. While labels are easy to round, Edit text is not. You can customize using 9 patch images. See B4A forum. Forum browsing is free. Only library download is restricted.

0

I should point you to the B4A forums where all the knowledgebase of the B4A IDE is. http://www.basic4ppc.com/android/forum/

There is a lot of UI related discussion there too, just to point to some random tutorials there:

http://www.basic4ppc.com/android/forum/threads/how-they-do-1.20878/ http://www.basic4ppc.com/android/forum/threads/how-they-do-2.20970/ http://www.basic4ppc.com/android/forum/threads/how-they-do-3.21137/

...and there is a lot more.

For the edit text you can use a ColorDrawable or a 9Patch image.

thedesolatesoul
  • 138
  • 1
  • 6