当前位置: 代码迷 >> Android >> 安卓按键设立TextView字体的大小
  详细解决方案

安卓按键设立TextView字体的大小

热度:78   发布时间:2016-04-28 07:41:59.0
安卓按键设置TextView字体的大小

Activity里面的函数为

button1 = (Button)layout.findViewById(R.id.button1);
   button2 = (Button)layout.findViewById(R.id.button2);
   text = (TextView)layout.findViewById(R.id.textView2);
   text1 = (TextView)layout.findViewById(R.id.textView3);
   text.setText(String.valueOf(size));
   
   button1.setOnClickListener(new OnClickListener() {
    
    @Override
    public void onClick(View arg0) {
     // TODO 自动生成的方法存根
     size++;
     text.setText(String.valueOf(size));
     text1.setTextSize(size);
    }
   });
   
   button2.setOnClickListener(new OnClickListener() {
      
      @Override
      public void onClick(View arg0) {
       // TODO 自动生成的方法存根
       size--;
       text.setText(String.valueOf(size));
       text1.setTextSize(size);
      }
     });

 

 

  相关解决方案