Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8201619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:52:37+00:00 2026-06-07T06:52:37+00:00

I’m trying to create a better looking button bar for my app to match

  • 0

I’m trying to create a better looking button bar for my app to match the theme.
So far, I’m using the following code:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/footer"
    style="@android:style/ButtonBar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="bottom"
    android:orientation="horizontal" >

    <Button
        android:id="@+id/Formula"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Formula" />

    <Button
        android:id="@+id/Solve"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Solve" />

    <Button
        android:id="@+id/Clear"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Clear" />
</LinearLayout>

And it gives me a result like this:
enter image description here

I’m also working on some code to replace that bar with a better looking one. It is as follows:

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:layout_alignParentBottom="true" >

    <View
        android:layout_width="match_parent"
        android:layout_height="1dip"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="4dip"
        android:layout_marginRight="4dip"
        android:background="@drawable/black_white_gradient" />

    <View
        android:id="@+id/ViewOne"
        android:layout_width="1dip"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="4dip"
        android:layout_marginTop="4dip"
        android:background="@drawable/black_white_gradient" />

    <Button
        android:id="@+id/ButtonOne"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_toLeftOf="@id/ViewOne"
        android:background="@color/button_blue_background"
        android:paddingTop="5dp"
        android:text="Cancel"
        android:textColor="@color/button_dark_text" />

    <Button
        android:id="@+id/ButtonTwo"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@id/ViewOne"
        android:background="@color/button_blue_background"
        android:text="OK"
        android:textColor="@color/button_dark_text" />
</RelativeLayout>

Which results in:
enter image description here

So my issue is that I’m unable to get three buttons on the new black bar. I’ve tried adding more views and buttons with the android:layout_toRightOf attributes but it still won’t work.
Are there any ideas on what I could possibly do to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T06:52:40+00:00Added an answer on June 7, 2026 at 6:52 am

    You don’t need to add Views to the layour just to show your gradients.

    I suggest you to use your LinearLayout with those three buttons and set a layer-list xml as the background of the layout itself.

    1. Create the layer-list xml file, eg, layerlist.xml with your gradients:

      <?xml version="1.0" encoding="utf-8"?>
      <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
         <item
           android:drawable="@drawable/gradient1"
           android:id="@+id/grad1"
         />
      
         <item
           android:drawable="@drawable/gradient2"
           android:id="@+id/grad2"
         />
      </layer-list>
      

      If you have just one gradient then you don’t need a layer-list xml file. Set it directly as background of the LinearLayout.

    2. As I said before, set the layerlist.xml (or your single gradient xml file) as background of the layout:

      <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/footer"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="bottom"
        android:orientation="horizontal"
        android:background="@drawable/layerlist" >
      
          <Button
            android:id="@+id/Formula"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Formula" />
      
         <Button
            android:id="@+id/Solve"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Solve" />
      
         <Button
            android:id="@+id/Clear"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Clear" />
      </LinearLayout>
      

    Let me know if it works!

    EDIT:

    As far as I know, you can define a proper height to the gradient. Add android:top="3dp" to the desired item of your layerlist.xml file. That means your gradient will have height of 3dp starting from the top.
    Or, if you are using a single gradient file you can define the grandient’s height adding to your shape:

    <size
          android:height="3dp" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm trying to create an if statement in PHP that prevents a single post
I am using Paperclip to handle profile photo uploads in my app. They upload
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.