zoukankan      html  css  js  c++  java
  • 4.2.1 TextView

     <TextView
            android:id="@+id/textview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/hello_world" />

    private TextView textview;
     @Override
     protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      textview = (TextView)findViewById(R.id.textview);
      String string = "TextView示例,欢迎使用!";
      /*设置文本的颜色*/
      textview.setTextColor(Color.RED);
      /*设置字体大小*/
      textview.setTextSize(20); 
         /*设置文字背景*/
      textview.setBackgroundColor(Color.BLUE);
      /*设置TextView显示的文字*/
      textview.setText(string);
     }

  • 相关阅读:
    HGE tutorial04
    HGE tutorial03
    HGE tutorial02 plus
    HGE tutorial02
    C 语言实例
    C 语言实例
    C 语言实例
    C 语言实例
    C 语言实例
    C 语言实例
  • 原文地址:https://www.cnblogs.com/chengpeng/p/5177120.html
Copyright © 2011-2022 走看看