Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build an Interactive Story App (Retired) Finishing the User Interface Customizing the Buttons

Patrick John Barry
Patrick John Barry
1,645 Points

There's a grey bar in between the two buttons, how do I remove it?

I've placed both buttons, but there seems to be a divider between the two. How can I remove it or change the colour?

Daniel Hartin
Daniel Hartin
18,106 Points

Hi Patrick

Any chance you could paste in you XML code please? there shouldn't be any space between 2 views unless you specify it.

Thanks Daniel

Patrick John Barry
Patrick John Barry
1,645 Points

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.pj.interactivestory.ui.StoryActivity" android:background="@android:color/white">

<ImageView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/storyImageView"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:src="@mipmap/page0"
    android:scaleType="fitXY"
    android:adjustViewBounds="true" />

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/storyTextView"
    android:layout_below="@+id/storyImageView"
    android:layout_alignLeft="@+id/storyImageView"
    android:layout_alignStart="@+id/storyImageView"
    android:text="You continue your course to Earth. Two days later, you receive a transmission from HQ saying that they have detected some sort of anomaly on the surface of Mars near an abandoned rover. They ask you to investigate, but ultimately the decision is yours because your mission has already run much longer than planned and supplies are low."
    android:paddingLeft="30dp"
    android:paddingRight="30dp"
    android:paddingTop="15dp"
    android:lineSpacingMultiplier="1.2"/>

<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Stop and investigate"
    android:id="@+id/choiceButton2"
    android:background="@android:color/white"
    android:textColor="#ff3a8aec"
    android:layout_alignParentBottom="true"
    android:layout_alignLeft="@+id/storyTextView"
    android:layout_alignStart="@+id/storyTextView" />

<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Continue home to Earth"
    android:id="@+id/choiceButton1"
    android:background="@android:color/white"
    android:textColor="#FF3A8AEC"
    android:layout_above="@+id/choiceButton2"
    android:layout_alignLeft="@+id/choiceButton2"
    android:layout_alignStart="@+id/choiceButton2" />

It seems to only appear in the preview of the design tab. The grey bar does not appear when the app is launched. So I guess not the biggest deal, somewhat annoying nonetheless.

Thank you Daniel for responding though.

1 Answer

Aarthi Singh
Aarthi Singh
3,373 Points

You can add a custom style to button to remove that grey line:

style="?android:attr/borderlessButtonStyle"

The final code will look like:

        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Continue home to Earth"
        android:id="@+id/choiceBtn1"
        android:layout_above="@+id/choiceBtn2"
        android:layout_alignStart="@+id/choiceBtn2"
        android:background="#ffffff"
        android:shadowColor="#ffffff"
        android:textColor="#3a8aec"
        style="?android:attr/borderlessButtonStyle"/> ```
Seph Cordovano
Seph Cordovano
17,400 Points

Aarthi Singh, thanks! you saved me some time and research!