当前位置:操作系统 > 安卓/Android >>

ListView底部分格线测试

重载Activity类

[java] public class GinwaveIMusicFrmaeHanderActivity extends Activity { 
     
    private LayoutInflater mInflater; 
    private Button mFrameTopLeftButton; 
    private TextView mFrameTopMiddleTextView; 
    private Button mFrameTopRightButton; 
     
    private LinearLayout mLinearLayout; 
     
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
         
        setVolumeControlStream(AudioManager.STREAM_MUSIC); 
    } 
     
    public void setupViews(int id){ 
        mInflater = (LayoutInflater)this.getLayoutInflater(); 
         
        mLinearLayout = (LinearLayout)mInflater.inflate(R.layout.frame_layout_header, null); 
        mFrameTopLeftButton = (Button)mLinearLayout.findViewById(R.id.frame_top_left); 
        mFrameTopMiddleTextView = (TextView)mLinearLayout.findViewById(R.id.frame_top_middle); 
        mFrameTopRightButton = (Button)mLinearLayout.findViewById(R.id.frame_top_right); 
         
        mFrameTopLeftButton.setOnClickListener(new ClickFrameTopViewListener()); 
        mFrameTopRightButton.setOnClickListener(new ClickFrameTopViewListener()); 
        View localLinear = (View)mInflater.inflate(id, null); 
        mLinearLayout.addView(localLinear, mLinearLayout.getChildCount()); 
        setContentView(mLinearLayout); 
    } 
     
    public void setFrameTopLeftButtonDTI(int pDrawableId, String pText){ 
        mFrameTopLeftButton.setVisibility(View.VISIBLE); 
        mFrameTopLeftButton.setBackgroundResource(pDrawableId); 
        mFrameTopLeftButton.setText(pText); 
    } 
     
    public void setFrameTopLeftButtonTI(String pText){ 
        mFrameTopLeftButton.setVisibility(View.VISIBLE); 
        mFrameTopLeftButton.setText(pText); 
    } 
     
    public void setFrameTopMiddleTextView(String pText){ 
        mFrameTopMiddleTextView.setText(pText); 
    } 
     
    public void setFrameTopRightButtonDTI(int pDrawableId, String pText){ 
        mFrameTopRightButton.setVisibility(View.VISIBLE); 
        mFrameTopRightButton.setBackgroundResource(pDrawableId); 
        mFrameTopRightButton.setText(pText); 
    } 
     
    public void setFrameTopRightButtonTI(String pText){ 
        mFrameTopRightButton.setVisibility(View.VISIBLE); 
        mFrameTopRightButton.setText(pText); 
    } 
     
    public void handleClickOnFrameTopLeftButton(){ 
         
    } 
     
    public void handleClickOnFrameTopRightButton(){ 
         
    } 
     
    class ClickFrameTopViewListener implements OnClickListener{ 
 
        public void onClick(View v) { 
            // TODO Auto-generated method stub  
            if((TextView)v == mFrameTopLeftButton){ 
                handleClickOnFrameTopLeftButton(); 
            } 
            if((TextView)v == mFrameTopRightButton){ 
                handleClickOnFrameTopRightButton(); 
            } 
        } 
         
    } 

public class GinwaveIMusicFrmaeHanderActivity extends Activity {
 
 private LayoutInflater mInflater;
 private Button mFrameTopLeftButton;
 private TextView mFrameTopMiddleTextView;
 private Button mFrameTopRightButton;
 
 private LinearLayout mLinearLayout;
 
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  
  setVolumeControlStream(AudioManager.STREAM_MUSIC);
 }
 
 public void setupViews(int id){
  mInflater = (LayoutInflater)this.getLayoutInflater();
  
  mLinearLayout = (LinearLayout)mInflater.inflate(R.layout.frame_layout_header, null);
  mFrameTopLeftButton = (Button)mLinearLayout.findViewById(R.id.frame_top_left);
  mFrameTopMiddleTextView = (TextView)mLinearLayout.findViewById(R.id.frame_top_middle);
  mFrameTopRightButton = (Button)mLinearLayout.findViewById(R.id.frame_top_right);
  
  mFrameTopLeftButton.setOnClickListener(new ClickFrameTopViewListener());
  mFrameTopRightButton.setOnClickListener(new ClickFrameTopViewListener());
  View localLinear = (View)mInflater.inflate(id, null);
  mLinearLayout.addView(localLinear, mLinearLayout.getChildCount());
  setContentView(mLinearLayout);
 }
 
 public void setFrameTopLeftButtonDTI(int pDrawableId, String pText){
  mFrameTopLeftButton.setVisibility(View.VISIBLE);
  mFrameTopLeftButton.setBackgroundResource(pDrawableId);
  mFrameTopLeftButton.setText(pText);
 }
 
 public void setFrameTopLeftButtonTI(String pText){
  mFrameTopLeftButton.setVisibility(View.VISIBLE);
  mFrameTopLeftButton.setText(pText);
 }
&nbs

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,