1

I am trying to make the corners of linearlayout rounded using this SO answer. So here is my shape.xml:

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
    <stroke android:width="2dp" android:color="#FFFFFFFF" />
    <gradient android:startColor="#ffc578" android:endColor="#fb9d23"
              android:angle="225"/>

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

But this gives me a rectangle shape with ugly black border.It looks horrible inside another linearlayout with a beautiful background image. I want to get rid of that black border. I have searched through other SO posts and google, only to find that I can use layers to hide some borders.Is it not possible using some trick in above shape.xml directly?

EDIT:

Here is my layout main.xml:

<?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"
              android:background="@drawable/MovieHopBackground"
              android:weightSum="12"
        >
    <ImageView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="3"
            android:id="@+id/imageView"/>
    <LinearLayout
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="0"
            android:layout_weight="2"
            android:weightSum="4"
            android:background="@drawable/shape">
        <RelativeLayout
                android:orientation="horizontal"
                android:layout_width="0"
                android:layout_height="fill_parent"
                android:layout_weight="3"

                >
            <EditText
                    android:layout_width="150dp"
                    android:layout_height="50dp"
                    android:background="@drawable/rounded_edittext"
                    android:id="@+id/editText"
                    android:layout_centerInParent="true"
                    />

        </RelativeLayout>
        <RelativeLayout
                android:orientation="horizontal"
                android:layout_width="0"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                >

        </RelativeLayout>
    </LinearLayout>

</LinearLayout>

EDIT2: Here is the screenshot as in ide(cropped):

enter image description here

Community
  • 1
  • 1
rahulserver
  • 10,411
  • 24
  • 90
  • 164

2 Answers2

0

try this

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle">
    <solid android:color="#ffffff"/>
    <corners android:radius="10dip"/>
    <stroke android:color="#00000000" android:width="1dp"/>  

</shape>
Hardik
  • 17,179
  • 2
  • 35
  • 40
0

Firstly,
Change android:layout_width="0" to android:layout_width=0dp in Relative Layouts.

Next,
Remove <stroke android:width="2dp" android:color="#FFFFFFFF" /> from your shape.xml

Check if @drawable/MovieHopBackground has any probs that might cause this issue.

I suggest you have a look at this.

Hope it helps!

Community
  • 1
  • 1
Chinmay Dabke
  • 5,070
  • 11
  • 40
  • 63
  • It doesnt seem to be an issue with shape.xml. I replaced android:background="@drawable/shape" with android:background="#ffc578" but same effect. And there is no prob with "@drawable/MovieHopBackground" as far as I can guess as its displaying like a gem. – rahulserver Feb 14 '14 at 12:22
  • Please post the screenshot of the issue. It will be easier for me to help you as right now I am not able to visualize it! – Chinmay Dabke Feb 14 '14 at 12:24