android 实现类似选项卡的UI


效果图如下

android 实现类似选项卡的UI_第1张图片


Xml 布局如下:




    

        

        

    

    



button text xml



    
    

radio button left xml



    
        
            
            
            

            
        
    
    
        
            
            
            
            
        
    



radio button right xml



    
        
            
            
            
            
        
    
    
        
            
            
            
            
        
    



代码如下 

package net.sytm.liaoningmobile.controller;

import android.widget.RadioGroup;

import net.sytm.liaoningmobile.R;
import net.sytm.liaoningmobile.base.BaseActivity;

/**
 * Created by aoc on 2016/10/9.
 */

public class LoginController implements RadioGroup.OnCheckedChangeListener {

    private BaseActivity activity;

    public LoginController(BaseActivity activity) {
        this.activity = activity;
        initView();
    }

    private void initView() {
        RadioGroup radioGroup = (RadioGroup) activity.findViewById(R.id.switch_btn_id);
        radioGroup.setOnCheckedChangeListener(this);
    }

    @Override
    public void onCheckedChanged(RadioGroup group, int checkedId) {
        switch (checkedId) {

        }
    }
}


你可能感兴趣的:(Android)