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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:13:05+00:00 2026-06-03T18:13:05+00:00

I have a custom dialog in my app that descends from Activity and uses

  • 0

I have a custom dialog in my app that descends from Activity and uses RelativeLayout, with all positioning and properties being handled by the XML file and none in the code. I have the layout exactly the way I want it, but because of the length of some of the items in the dialog, some lines of the information wrap to the next line. This isn’t a problem, except for the fact that the Close button in the dialog looks like someone sat on it in these cases.

This is a screenshot from the emulator that shows the button as fine, but I want some padding on the right of the description text so it’s not butted up against the right side of the dialog:

Good button, but needs right margin

Seeing this, I added android:layout_marginRight="5dp" to the layout file, hoping to get my margin, which it seems to do – and I get my wrap – but the button isn’t right. The height of the dialog isn’t changing when I would expect it to because the description is now wrapping a line.

Good wrapping, but button squished

Here’s my full layout XML. This is the first time I’ve used RelativeLayout, so hopefully this is something simple I’m overlooking.

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
        <ImageView
                android:id="@+id/achievement_icon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="7dp"
                android:contentDescription="@string/achievement_icon" />
        <TextView
                android:id="@+id/achievement_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:textColor="#ffffff"
                android:textStyle="bold"
                android:layout_toRightOf="@+id/achievement_icon" />
        <TextView
                android:id="@+id/achievement_gamerscore"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#ffffff"
                android:textStyle="bold"
                android:layout_marginLeft="5dp"
                android:layout_below="@+id/achievement_name"
                android:layout_toRightOf="@+id/achievement_icon" />
        <TextView
                android:id="@+id/achievement_description"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="7dp"
                android:layout_marginRight="5dp"
                android:layout_alignLeft="@+id/achievement_icon"
                android:layout_below="@+id/achievement_icon" />
        <TextView
                android:id="@+id/achievement_earned"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="7dp"
                android:layout_marginRight="5dp"
                android:layout_alignLeft="@+id/achievement_description"
                android:layout_below="@+id/achievement_description" />
        <Button
                android:id="@+id/cancel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="7dp"
                android:layout_centerHorizontal="true"
                android:text="@string/button_close"
                android:layout_below="@+id/achievement_earned" />
    </RelativeLayout>
  • 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-03T18:13:09+00:00Added an answer on June 3, 2026 at 6:13 pm

    The problem is you’re running out of room for the button.

    To make room for the button:

    1.)You can move the button maybe top right and display it as like an x.

    2.)You could limit the size of the description TextView and set it to scroll vertically by surrounding the TextView in a scrollview (cleaner ways to do this also without the need of the ScrollView but you get my drift.

    3.) Make the height of the button smaller.

    Also I’d be wary of how the app phone looks on phones with different screens resolutions/densities. So please be aware of this when designing the UI.

    Example of what I mean is:

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical"
        android:fillViewport="true">
    
         <TextView
                android:id="@+id/achievement_description"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="7dp"
                android:layout_marginRight="5dp"
                android:layout_alignLeft="@+id/achievement_icon"
                android:layout_below="@+id/achievement_icon" />
    
    </ScrollView>
    

    However you will need to limit the height of the “achievement_description” textview to a certain value instead of wrapping content.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my app I have a custom dialog that works great on my stock
I have an ASP MVC app that uses it's own custom authentication mechanism. However
I have a custom Dialog that contains only a TextView to display some text
I have custom classes that I currently instantiate within App.xaml as resources. I want
I have a custom RatingBar in my app that should display either the site
I have a custom Dialog that shows a few buttons. The idea is to
I have a Cocoa app with a custom, multi-step account setup that I implemented
I am trying to create a custom dialog class that inherits from Dialog that
I have a Windows App with custom dialog forms. i was wondering if it
I have a custom dialog box that asks the user for some input. It's

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.