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

The Archive Base Latest Questions

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

I have the following ToggleButton in xml: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=46dp android:gravity=center > <ToggleButton

  • 0

I have the following ToggleButton in xml:

<RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="46dp"
        android:gravity="center" >

        <ToggleButton
            android:id="@+id/toggleButton1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:text="ToggleButton"
            android:textOff="Inactive"
            android:textOn="Active" />

        <TextView
            android:id="@+id/label_note"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_centerVertical="true"
            android:layout_marginRight="38dp"
            android:layout_marginLeft="2dip"
            android:layout_toRightOf="@+id/check_note"
            android:text="@+id/label"
            android:textSize="25px" />
        ...
</RelativeLayout>

In my class that extends a listview I would like to programatically set the togglebutton on active/inactive based on some criterias. I would like to specify that I do not what the user to be able to click on the togglebutton and set it on active or inactive. How to do that? Need some help. Appreciate!

  • 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-03T14:05:07+00:00Added an answer on June 3, 2026 at 2:05 pm

    to make the button not clickable, just disable the toggle button:

    mToggleButton.setEbabled(false);
    

    or set it not to be clickable:

    mToggleButton.setClickable(false);
    

    and for programatically change the button state, use:

    mToggleButton.setActivated(true); 
    mToggleButton.setActivated(false);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following scenario: The Android clients communicate with a PHP server via HTTP
I have following xml: <TextWithNodes><Node id=0 />astralis<Node id=8 /> <Node id=9 />ltd<Node id=12 />
I have following xml: <TextWithNodes><Node id=0 />astralis<Node id=8 /> <Node id=9 />ltd<Node id=12 />
I have following asp hyperlink: <asp:HyperLink ID=a runat=server Text=return NavigateUrl=https://google.com/></asp:HyperLink > What i want
I have a ToggleButton to which I'm applying the following style <Style x:Key=ToggleButtonStyle TargetType=ToggleButton>
I have following xml file: <os:tax> <os:cat name=abc id=1> <os:subcat name=bcd id=11> <os:t name=def
I have following script and it works fine with FF and Safari. function swapimage(cid)
I have following class. In this, Iris is another class with some attributes. public
I have following class public abstract class Rule { protected Rule() { Nodes =
I have following seed input data: Payperiod start: Dec 3rd Payperiod end: Dec 16

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.