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 6024485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:09:44+00:00 2026-05-23T04:09:44+00:00

A custom Dialog box with a RelativeLayout contains a Button widget that won’t change

  • 0

A custom Dialog box with a RelativeLayout contains a Button widget that won’t change its margins, regardless of direction. Here’s the xml:


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:orientation="horizontal" android:background="#99000000">
    <TextView android:id="@+id/dialogtitle" android:layout_width="fill_parent"
         android:layout_height="wrap_content" android:text="Some text" />
    <TextView android:id="@+id/dialogtext" android:layout_width="300dp"
        android:layout_height="wrap_content" android:textSize="15dp"
        android:layout_alignParentLeft="true" android:layout_below="@id/dialogtitle"
        android:paddingLeft="8dp" />
    <Button android:id="@+id/dialogbuttoninfo" android:layout_width="80dp"
        android:layout_height="wrap_content" android:text="Doesn't care about margins"
        android:layout_alignParentRight="true" android:layout_marginLeft="128dp" />
</RelativeLayout>

Padding works but only moves the text inside the button. Any suggestions?

  • 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-23T04:09:45+00:00Added an answer on May 23, 2026 at 4:09 am

    This seems crappy but have you tried putting it all in a LinearLayout instead? or perhaps removing android:orientation="horizontal". I dont think RelativeLayout cares about orientation from what I’ve seen. Also I think, but might be wrong, that if you do a LinearLayout then you won’t need to have android:layout_alignParentLeft="true" in there either.

    After cleaning it up a bit (sorry but its so hard to read when its compressed as it was in the question) you also didn’t state where the last TextView , dialogbuttoninfo was supposed to be relative to everything else, I think you have to do that for Relative layouts to behave properly, I’ve had some squirrely things happen.

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="#99000000">
        <TextView
            android:id="@+id/dialogtitle"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Some text" />
        <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">
            <TextView
                android:id="@+id/dialogtext"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:textSize="15dp"
                android:layout_alignParentLeft="true"
                android:paddingLeft="8dp" />
            <Button
                android:id="@+id/dialogbuttoninfo"
                android:layout_width="80dp"
                android:layout_height="wrap_content"
                android:text="Doesn't care about margins"
                android:layout_alignParentRight="true"
                android:layout_marginLeft="128dp" />
        </LinearLayout>
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom Dialog that contains only a TextView to display some text
I am trying to create a custom dialog box that displays an image in
I'm attempting to add a custom dialog box to my current GUI that can
I have a custom dialog box that asks the user for some input. It's
I have a custom dialog box that collects two strings from the user. I
I have a WiX installer project that utilises a custom dialog box to ask
I am trying to write a custom dialog box that takes a name from
I would like to display some variables in custom dialog box. For example I
So I got a dialog box that is loaded dynamically using AJAX, in that
I have created a custom dialog, the code is below. The problem is that,

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.