Adjust the color and font style of the title text in the dialog box

I need assistance in altering the font and color of the title within a dialog box. I am looking to modify the font, size, and color. What steps should I take?

Below is the code snippet:

ivworknggroup.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub

                final Dialog dialog = new Dialog(Ourwork.this);
                dialog.setContentView(R.layout.nggroup);
                dialog.setTitle("N.G.GROUP");

                TextView tvnggroup1 = (TextView) dialog.findViewById(R.id.tvnggroup1);

                TextView tvnggroup2 =(TextView)dialog.findViewById(R.id.tvnggroup2);

                Typeface typeFace1 =  Typeface.createFromAsset(getAssets(),"fonts/antennalight.ttf");
                tvnggroup1.setTypeface(typeFace1);
                Typeface typeFace =  Typeface.createFromAsset(getAssets(),"fonts/antennabold.ttf");
                tvnggroup2.setTypeface(typeFace);

                tvnggroup2.setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View arg0) {
                        // TODO Auto-generated method stub
                        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.nggroupindia.com/"));
                        startActivity(browserIntent);
                    }
                });
                dialog.show();

            }
        });

Could someone offer guidance on this issue? Thank you.

Answer №1

I once encountered a similar situation, but I found a solution that worked for me.

A dialog named sortDialog was created in my application. It had a custom layout called adtype_alertdialog with the title "N.G.GROUP". To customize the dialog further, I identified the divider and title elements by their IDs - android:id/titleDivider and android.R.id.title. By changing the background color and text color of these elements to yellow, I was able to enhance the appearance of the dialog before displaying it to the user.

The identifiers android:id/titleDivider and android.R.id.title can be located in the alert_dialog.xml file within your SDK folder.

Answer №2

If you are looking to customize the title of your dialog, consider using a custom view. You can find helpful information on how to achieve this by following this link: how to include custom title view within an AlertDialog in android?

Answer №3

give this method a try

private String PUMPKIN_ORANGE = "#FF7F27";

AlertDialog dialogAlert = new AlertDialog.Builder(this).setMessage("Message").show();

setTitle("Title").
setTitleColor(PUMPKIN_ORANGE).

setDividerColor(PUMPKIN_ORANGE).

TextView textViewer = (TextView) dialogAlert.findViewById(android.R.id.message);
textViewer.setTextSize(10);//to adjust font size
textViewer.setTextColor(Color.RED); // to modify color
//to change font family
Typeface fontDesign = Typeface.createFromAsset(getAssets(),"font/fontFileName.ttf");
textViewer.setTypeface(fontDesign);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating a personalized contact form with a mailto link that also includes the ability to automatically copy information into the email

I'm in the process of developing a basic contact form that includes input fields for name and subject, as well as a send button (which is an <a> element inside a <div>. I am utilizing an <a> tag because I intend to use mailto functio ...

What is the best way to ensure my arrow text remains properly positioned when using fullpage.js?

Seeking guidance from the web development community. I am currently working on a client's website that utilizes fullpage.js and encountering a persistent issue. On slide1 of the website, I am struggling to display the correct text next to the arrows. ...

Modifying a defined value in XML using Java code on Android: What is the process?

I am dealing with a situation where I have various tabs containing text, along with an additional tab dedicated to GUI elements that allow users to adjust the default text size. The default value for the text size is already specified in the XML files. W ...

Flutter issue: The ScrollController is not connected to any scroll views causing a problem with scrolling

As I navigate through my listview, a recurring error message floods the console: The ScrollController is not attached to any scroll views. 'package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 110 pos 12: '_positions. ...

How can I place a new ThreeJS child element at the front and center of a scene?

I have been working on a webpage that is inspired by the CSS3D molecules sample from ThreeJS's library. You can check out the original sample here. In my project, I am dynamically creating new nodes (atoms) and attaching them to existing nodes. Once ...

Ensure that the div expands to accommodate the content

I'm experiencing an issue where the content within a div with a blue border exceeds the boundaries of the div when it expands. How can I make sure that the div extends to contain all the content? Here is a demonstration of the problem: When I expand ...

Interval function not initiating properly post bullet navigation activation

Currently, I am experiencing an issue with my custom slider where the auto sliding set interval function is not working after using the bullet navigation. Despite trying to implement "setTimeout(autoSlide, 1000);", it doesn't seem to be resolving the ...

Enhancing the brightness of a dark region within an image using openCV

I've encountered a challenge while working on an Android road sign detection application with OpenCV. I noticed that when processing frames in real-time, the camera often focuses on brighter areas of the image like the sky, causing everything else bel ...

Leveraging a unique CSS stylesheet in conjunction with react bootstrap and webpack for enhanced

I am attempting to integrate React with this theme (), and have replaced the homepage/node_modules/bootstrap files with the ones provided. However, the website is still pulling styles from the original CSS files. Any suggestions on how to resolve this issu ...

Having a minimum width set on the body element can lead to problems with

Having some difficulty creating a responsive Tagcloud. Encountering issues in the max-width 400px section. Despite using width: auto and box sizing border-box, a horizontal scrollbar appears at 326px in Chrome, as shown in the image below. https:/ ...

Tips for generating more compact CSS files to simplify your development workflow

At the moment, I have included two CSS files within my <head> tags: <link rel="stylesheet" href="/stylesheets/init.css"> <link rel="stylesheet" href="/stylesheets/layout.css"> The init.css file is used for resetting elements and definin ...

Having trouble selecting content in an HTML document using Xpath and response.css with Scrapy?

Something is quite puzzling me and I've been pondering over it for almost a week now. Perhaps the solution is staring right at me and I just can't see it clearly... Any hints for alternative approaches would be greatly appreciated. I have n ...

Why do they call me the Commander of Errors?

Alert: PowerShell has detected that a screen reader may be in use and has disabled PSReadLine for compatibility reasons. To re-enable it, simply run 'Import-Module PSReadLine'. PS C:\Web Development> scss --style expanded "c:\W ...

Why is JMDNS not compatible with a 4G network?

I have been experimenting with jmdns to discover mobile devices. When connected to wifi or 3G, the devices are detectable. However, when using a 4G connection, it shows no detected devices. ConnectivityManager conMgr = (ConnectivityManager) getSystemServi ...

One cannot focus on HTML if it's disabled

I am currently exploring options to prevent an input from receiving focus without disabling it entirely. I need the backend to still retrieve data, but I want to restrict user editing of the input fields at certain times. Disabling the input is not an opti ...

Capture and trim a photo using Cooliris

In my app, I have successfully implemented the functionality to take pictures and crop them. However, I am encountering an issue on devices with Cooliris gallery installed. After taking an image, a message stating "Gallery(process com.cooliris.media) has s ...

Display a preloader image while waiting for the content to load using jQuery or AJAX

Hey there, I could really use some help with a little issue. I've been trying to use the click() and load() functions to bring my content into a specific CSS class. $("#feed").click(function(){ $(".homefeed").load("feedcontainer.php"); ...

I would like a div element to slide up from the bottom of the page

Could someone please assist me in creating a popup div that appears from bottom to top when a specific button is clicked? I would like the div to be fixed without affecting the overall page content. Any help would be greatly appreciated. Thank you! $( ...

The search for AndroidBootstrap was unsuccessful

What is the solution for importing an Eclipse project into Android Studio? Check out this image to understand the issue: https://i.sstatic.net/OZQcl.png ...

Access Google Authentication through Firebase ->

I recently followed a tutorial on implementing Google Login into my App, which can be found here: https://firebase.google.com/docs/auth/android/google-signin?authuser=0 The code structure that I used is very similar to the one provided in this repository: ...