Making buttons that look like tabs in android

前端 未结 3 1572
温柔的废话
温柔的废话 2020-12-28 10:22

I want this kind of look. They don\'t seem like tabs so I believe they are buttons.

\"enter

3条回答
  •  不思量自难忘°
    2020-12-28 10:42

    Use simple button instead of toogle button. And set background like this:

    I am giving example for 1 button:

     android:background="@drawable/data_button_select_state"
    

    And add a xml file in your 'drawable' folder named data_button_select_state:

    
     
     
     
     
    
    

    Now add code in java file like this:

    when data button clicked:

      data_button.setOnClickListener(new View.OnClickListener() {
    
            @Override
            public void onClick(View v) {
                data_button.setActivated(true);
                H_chart_button.setActivated(false);
                                w_chart_button.setActivated(false);
                                hc_chart_button.setActivated(false);
    
            }
        });
    

    change other button like this as well. This will might help you...

提交回复
热议问题