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

  • SEARCH
  • Home
  • 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 7638569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:12:23+00:00 2026-05-31T08:12:23+00:00

I am trying to horizontally align an EditText with a Button without success. Both

  • 0

I am trying to horizontally align an EditText with a Button without success. Both should be of the same height and their tops and bottoms should align with each other. Here’s my code:

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <EditText
        android:id="@+id/quantity"
        android:inputType="number"
        android:layout_height="fill_parent"
        android:layout_width="100dp"
        android:layout_toRightOf="@id/quantity_label"
        android:background="@android:drawable/editbox_background" />
    <Button
        android:onClick="submitButtonTapped"
        android:id="@+id/submit"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_toRightOf="@id/quantity"
        android:drawableLeft="@drawable/submit_icon"
        android:drawablePadding="5dp"
        android:text="@string/submit" />
</LinearLayout>

The result is that the bottom of the two elements are aligned. The focus border of the EditText extends below the Button. The EditText does not extend to the height of the Button, even with the focus border. How do I get them aligned?

  • 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-05-31T08:12:24+00:00Added an answer on May 31, 2026 at 8:12 am
    1. Set in dimen/line_height value.
    2. Use this layout
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="@dimen/line_height"
    android:orientation="horizontal" >
    <EditText
        android:id="@+id/quantity"
        android:inputType="number"
        android:layout_height="fill_parent"
        android:layout_width="100dp"
        android:background="@android:drawable/editbox_background" />
    
    <Button
        android:id="@+id/submit"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:drawableLeft="@drawable/submit_icon"
        android:onClick="submitButtonTapped"
        android:text="@string/submit" />
     </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get <head> and <head> to align horizontally. I've tried using
I'm trying to center both horizontally and vertically a div inside an outer div.
I'm trying to display tables next to each other horizontally, but this is what
I'm trying to align a div horizontally, but for some reason it's not working
I am trying to align two images horizontally using CSS. In CSS, I have:
I'm trying to center a <div> horizontally. I already have text-align: center; on the
I'm trying to display an unordered list horizontally. In each list item, I have
I'm trying to render 2 tables next to each other horizontally like this: |Table
I've been trying to successfully align the views so they look the same on
I'm trying to horizontally and vertically center a modal window inside a div. I

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.