0

This issue is testing my patience, I am designing a layout, this is where I have reached so far. Check below image

enter image description here

The part above "Save" button shows a complete black background, the one with currency and EditText.

What I was actually trying to do was remove the underline for the two EditText below the currency code. I was following different advice on this thread hence I made my linearLayout background set to #80000000. But the underline was still there below the EditBox and it spoiled my linearlayout.

Hence, I decided to remove it and try something else. When I removed that line of code from everywhere and run the program. I still get that black background in my app.

Here is the xml code for my linearLayout

<LinearLayout
        android:id="@+id/layout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_weight="2"
        android:paddingTop="10dp"
        android:layout_marginBottom="30dp"
        android:background="@drawable/custom_border"
        >
        <!--This layout is for typing currency values-->
        <!--Creating two more sub linearLayout, to seperate two sections of
        lef currency and right currency
         android:background="@drawable/border_inner_linear"
        -->
        <LinearLayout
            android:id="@+id/leftCurrencySection"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:layout_weight="1"
            android:orientation="vertical"

            >

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="GBP"
                android:textSize="30dp"
                android:textColor="#ffffff"
                android:textAllCaps="true"
                android:textStyle="bold"
                />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="0.00"
                android:textSize="30dp"
                android:textColor="#ffffff"
                android:textAllCaps="true"
                android:textStyle="bold"

                />

        </LinearLayout>

        <LinearLayout
            android:id="@+id/rightCurrencySection"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:layout_weight="1"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:text="USD"
                android:textSize="30dp"
                android:textColor="#ffffff"
                android:textAllCaps="true"
                android:textStyle="bold"
                />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:text="0.00"
                android:textSize="30dp"
                android:textColor="#ffffff"
                android:textAllCaps="true"
                android:textStyle="bold"

                />

        </LinearLayout>

    </LinearLayout>

As one can see, I don't have anything that shall show a black color in my LinearLayout with id layout1

Here is the ugly screen layout I am getting

enter image description here

It might be foolish of me to ask but does my app would be storing some sort of cache, because of which its showing same old layout?

Thanks in advance

EDIT

Here is the full code of the layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:background="@drawable/layer_list"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:showIn="@layout/activity_main"
    tools:context=".MainActivity"
    android:orientation="vertical"
    android:weightSum="5"
    >

    <LinearLayout
        android:id="@+id/layout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_weight="2"
        android:paddingTop="10dp"
        android:layout_marginBottom="30dp"
        android:background="@drawable/custom_border"
        >
        <!--This layout is for typing currency values-->
        <!--Creating two more sub linearLayout, to seperate two sections of
        lef currency and right currency
         android:background="@drawable/border_inner_linear"
        -->
        <LinearLayout
            android:id="@+id/leftCurrencySection"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:layout_weight="1"
            android:orientation="vertical"

            >

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="GBP"
                android:textSize="30dp"
                android:textColor="#ffffff"
                android:textAllCaps="true"
                android:textStyle="bold"
                />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="0.00"
                android:textSize="30dp"
                android:textColor="#ffffff"
                android:textAllCaps="true"
                android:textStyle="bold"
                android:background="@null"
                />

        </LinearLayout>

        <LinearLayout
            android:id="@+id/rightCurrencySection"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:layout_weight="1"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:text="USD"
                android:textSize="30dp"
                android:textColor="#ffffff"
                android:textAllCaps="true"
                android:textStyle="bold"
                />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:text="0.00"
                android:textSize="30dp"
                android:textColor="#ffffff"
                android:textAllCaps="true"
                android:textStyle="bold"
                android:background="@null"
                />

        </LinearLayout>

    </LinearLayout>
    <!--End of This layout is for typing currency values-->

    <LinearLayout
        android:id="@+id/buttonSection"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_weight="1"
        >
        <!--This layout is for save and change currency buttons-->
            <Button
                android:id="@+id/saveButton"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Save"/>

                <Button
                    android:id="@+id/currencyButton"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Save"/>
    </LinearLayout>
    <!--End of  save and change currency buttons-->

    <!--Begin Layout for calculator begin-->

    <GridLayout 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:columnCount="3"
        android:layout_gravity="center"
        android:orientation="horizontal"
        android:layout_weight="1"
        >


        <Button android:text="1"
            android:background="@null"
            />

        <Button android:text="2" />

        <Button android:text="3" />



        <Button android:text="4" />

        <Button android:text="5" />

        <Button android:text="6" />



        <Button android:text="7" />

        <Button android:text="8" />

        <Button android:text="9" />


        <Button android:text="." />

        <Button android:text="0" />

        <Button android:text="Del" />


    </GridLayout>
    <!--End Layout for calculator-->
    <!--End Layout for calculator End-->


</LinearLayout>

EDIT: Code for custom xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:left="-10dp" android:right="-10dp"  android:top="0dp"
        android:bottom="0dp">
        <shape android:shape="rectangle">
            <stroke android:width="3dp" android:color="#faf8f8" />
        </shape>
    </item>
</layer-list>
Community
  • 1
  • 1
Ishq Mehta
  • 387
  • 1
  • 5
  • 13
  • I think that's because the default background of the theme is black, try forcing a `null` background – ChristopheCVB Mar 06 '16 at 14:56
  • @ChristopheCVB: where do you suggest me to change the default background theme? In the mail xml? with my parent LinearLayout? It seems the black color is because of the custom xml that I have defined in the child linearLayout with id layout1 – Ishq Mehta Mar 07 '16 at 02:37

3 Answers3

0

remove the background of the linear layout.

if you want to remove the underline in the edittext then set the background of that edittext's to null.

android:background="@null"

<EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@null"
    android:gravity="right"
    android:text="0.00"
    android:textSize="30dp"
    android:textColor="#ffffff"
    android:textAllCaps="true"
    android:textStyle="bold" />
Avijit Karmakar
  • 8,890
  • 6
  • 44
  • 59
  • I think you didn't got the question, now I am not trying to remove underline. I am trying to remove the black background that linearlayout has got because of removing edittext underline – Ishq Mehta Mar 06 '16 at 14:37
  • It's a custom xml I have defined in my drawable, That's what makes the white border on top and bottom, It does not define anything black – Ishq Mehta Mar 06 '16 at 14:42
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/105488/discussion-between-avijit-karmakar-and-ishq-mehta). – Avijit Karmakar Mar 06 '16 at 14:50
0

android:background="@null" will remove the underline of edit text. I think you are getting black screen because of custom xml only.

cs95
  • 379,657
  • 97
  • 704
  • 746
Nikhil Chandu
  • 421
  • 3
  • 10
  • I have shared the code for custom xml. Strangely when I removed the background as custom xml. The black portion went away. But there does not seem to be any black color declaration inside my custom xml – Ishq Mehta Mar 07 '16 at 02:35
0
<TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
        android:backgroundTint="@color/white
        android:gravity="right"
                android:text="USD"`enter code here`
                android:textSize="30dp"
                android:textColor="#ffffff"
                android:textAllCaps="true"
                android:textStyle="bold"
                />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
        android:backgroundTint="@color/white"
        android:gravity="right"
                android:text="0.00"
                android:textSize="30dp"
                android:textColor="#ffffff"
                android:textAllCaps="true"
                android:textStyle="bold"

                />
user2173696
  • 151
  • 1
  • 2