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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:59:30+00:00 2026-06-09T15:59:30+00:00

I can’t find the solution! I am trying to be compliant with Android 2.1

  • 0

I can’t find the solution! I am trying to be compliant with Android 2.1 and later.

I try to create an equivalent to AlertDialog with a a custom theme.

I found that it is not possible to apply a theme on an AlertDialog before API v. 11. And I try to use ContextThemeWrapper, but I can’t find a solution to customize the buttons.

For a simple view, I create my own Dialog with my own content view. And I do what I want with the theme.

But, when I want an AlertDialog with a custom theme AND a list item, it is more complicated. I can’t find a solution to add button at the end of the list. Because when the list is too big, the buttons are outside the window.

I tried with :
– a RelativeLayout :
* Title
* ListView below title
* Buttons below ListView
– A LinearLayout vertical

Anyone has an idea ?

I add the result needed.

Maybe, my last, and very ugly idea, is to create a normal AlertDialog with a builder, find each view with findViewById and apply the desired theme attributes… but I have to see if the ids are constant since Android 2.1 …

My layout xml :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:bw="http://schemas.android.com/apk/res-auto/com.levelup.beautifulwidgets"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/title"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginBottom="8dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:background="@drawable/ab_background"
        android:paddingBottom="8dp"
        android:paddingTop="8dp"
        android:textColor="@color/grey_1"
        android:textSize="24dp" />

    <FrameLayout
        android:id="@+id/title_container"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="5dp"
        android:paddingRight="10dp" />

    <ListView
        android:id="@+id/container"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/title" />

    <LinearLayout
        android:id="@+id/buttons"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_below="@id/container"
        android:layout_marginTop="5dp"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/cancel_button"
            style="@style/DialogButton"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="-1dp"
            android:layout_weight="1"
            android:text="@string/cancel" />

        <Button
            android:id="@+id/ok_button"
            style="@style/DialogButton"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/ok" />
    </LinearLayout>

</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-09T15:59:31+00:00Added an answer on June 9, 2026 at 3:59 pm

    I found a solution. I an vertical LinearLayout. All the view are with a layout_weight to 0. Just the ListView is 1.

    <?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="wrap_content"
        android:orientation="vertical" >
    
        <RelativeLayout
            android:id="@+id/titleLayout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0"
            android:padding="5dp" >
    
            <FrameLayout
                android:id="@+id/title_container"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:paddingRight="10dp" />
    
            <TextView
                android:id="@+id/title"
                style="@style/Dialog.Title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_toLeftOf="@id/title_container" />
        </RelativeLayout>
    
        <RelativeLayout
            android:id="@+id/containerLayout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1" >
    
            <FrameLayout
                android:id="@+id/container"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" />
    
            <ImageView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:background="@drawable/dialog_header_divider" />
        </RelativeLayout>
    
        <View
            android:layout_width="fill_parent"
            android:layout_height="1dp"
            android:layout_weight="0"
            android:background="@color/grey_2" />
    
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0"
            android:orientation="horizontal" >
    
            <Button
                android:id="@+id/cancel_button"
                style="@style/Dialog.Button.Cancel"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="-1dp"
                android:layout_weight="1"
                android:text="@string/cancel" />
    
            <View
                android:id="@+id/buttonSeparator"
                android:layout_width="1dp"
                android:layout_height="fill_parent"
                android:layout_weight="0"
                android:background="@color/grey_2" />
    
            <Button
                android:id="@+id/ok_button"
                style="@style/Dialog.Button.Ok"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/ok" />
        </LinearLayout>
    
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone help me trying to find out why this doesn't work. The brushes
Can find why i get this error can someone help? package Android.data; public class
Basically, what I'm trying to create is a page of div tags, each has
Can someone guide me on a possible solution? I don't want to use /bin/cp
Can somebody give me advice on how to create a recursive version of GetEnumerator()?
Can't work out a way to make an array of buttons in android. This
Can anyone (maybe an XSL-fan?) help me find any advantages with handling presentation of
Can not find scala.actors package in latest milestones, while it still presents in scaladocs:
Can we create a table in mysql that limited to only one record. E.g.:
Can anyone share app/ways to record current android screen device? i know this app:

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.