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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:19:14+00:00 2026-05-25T19:19:14+00:00

I need to develop a button that has two label in. I find some

  • 0

I need to develop a button that has two label in.

I find some good articles about custom views, but I can’t imagine that how can I create a myButton Class(with custom layout in it) extends button… is it possible..

Also in XML some views,layouts…
How can we do this??

  • 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-25T19:19:14+00:00Added an answer on May 25, 2026 at 7:19 pm

    I writed this like,.. I have a layout problem. I cant fill screen with two buttons. parentlayout fills screen, but I cant these two buttons put should be..

    enter image description here

    My button layout:

    <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_height="wrap_content" 
            android:layout_width="fill_parent"
            android:layout_weight="1"
            android:gravity="center">
            <ImageView
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:id="@+id/xbutton2_icon" />
            <TextView
                    android:id="@+id/xbutton2_tv"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                     />
    </LinearLayout>
    

    And its class:

    public XButton2(Context context, AttributeSet attrs) {
            super(context, attrs);
            LayoutInflater layoutInflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View view = layoutInflater.inflate(R.layout.xbutton2, this);
            icon = (ImageView) view.findViewById(R.id.xbutton2_icon);
            tv = (TextView) view.findViewById(R.id.xbutton2_tv);
            init(attrs);
        }
        protected void init(AttributeSet attrs) {
            parseAttributes(attrs);
            setAttrs();
        }
        protected void parseAttributes(AttributeSet attrs) {
            TypedArray param = getContext().obtainStyledAttributes(attrs,
                    R.styleable.com_matriksdata_bavul_XButton2);
            this.text = param
                    .getString(R.styleable.com_matriksdata_bavul_XButton2_text);
            String str = param
                    .getString(R.styleable.com_matriksdata_bavul_XButton2_icon);
    
            if (str != null) {
                String[] arr = str.split("\\/");
                this.iconResorucesID = getResources().getIdentifier(
                        getContext().getApplicationContext().getPackageName() + ":"
                                + arr[arr.length - 2] + "/"
                                + arr[arr.length - 1].split("\\.")[0], null, null);
            }
            this.textSize = param.getFloat(
                    R.styleable.com_matriksdata_bavul_XButton2_textSize, 40);
    
            param.recycle();
        }
    
        protected void setAttrs() {
            if (text != null) {
                tv.setText(text);
                tv.setTextSize(XUtil.convertToPixcell(getContext(), textSize));
                // tv.setTextColor(textColor);
                // tv.setHighlightColor(textSelectedColor);
            }
            if (iconResorucesID != 0)
                icon.setImageResource(iconResorucesID);
    
        }
    
        public void setChecked(boolean isChecked) {
            if (isChecked) {
                // setBackgroundResource(selectedBg);
                tv.setSelected(true);
            } else {
                tv.setSelected(false);
                // setBackgroundResource(bg);
            }
            this.isChecked = isChecked;
        }
    

    And it is where I used it.

    <com.matriksdata.widget.SplitButtonController
                                android:layout_marginLeft="8dip"
                                android:layout_marginRight="8dip"
                                android:layout_width="fill_parent"
                                android:orientation="horizontal"
                                android:layout_height="wrap_content"
                                android:gravity="center_vertical"
    
                                >
                                <com.matriksdata.widget.XButton2
                                        mtx:text="@string/strFlight"
                                        mtx:textSize="20"
                                        mtx:icon="@drawable/flight_buttonicon"
                                        android:layout_width="fill_parent"
                                        android:layout_height="wrap_content" 
                                        android:layout_weight="1"/>
    
                                <com.matriksdata.widget.XButton2
                                        mtx:text="@string/strBus"
                                        mtx:textSize="20"
                                        mtx:icon="@drawable/bus_buttonicon_gray"
                                        android:layout_height="wrap_content"
                                        android:layout_width="fill_parent"
                                        android:layout_weight="1" />
                        </com.matriksdata.widget.SplitButtonController>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to develop a process that will detect if the users computer has
I need to develop some sort of application featuring Editing Movie slices, Adding and
I need to develop a page which has 2 dropdownlist. Options of dropdownlist 2
I need some help with GUI Iphone development I am currently develop iphone application
I need to develop custom login form which allows user to select language (locale).
I need to develop a project that needs to have a Ticker and an
Hi there I am currently testing how to develop an application that has several
I need to develop a small-medium sized desktop GUI application, preferably with Python as
I need to develop a generic jQuery-based search plugin for the ASP.NET MVC application
I need to develop a system for storing large numbers (10's to 100's of

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.