zoukankan      html  css  js  c++  java
  • Android 基础标签

        TextView标签

    <TextView
                android:text="我乃哈哈哈哈哈哈哈学习Androd"
                android:textSize="25dp"
                android:textColor="@android:color/holo_blue_dark"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:singleLine="true"
                />

    text:显示文本信息
    textSize:设置文本大小
    textColor:设置文本颜色
    singleLine:单行显示
    ellipsize:设置省略号显示的位置,默认是end(结尾) start(开头) middle(中间)

     

    <TextView
                android:text="哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈啊哈哈啊哈哈哈哈哈哈"
                android:textSize="25dp"
                android:textColor="@android:color/holo_blue_dark"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:ellipsize="marquee"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:marqueeRepeatLimit="1"
    
                />

    android:singleLine="true"
    android:ellipsize="marquee"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:marqueeRepeatLimit  循环滚动次数(属性值marquee_forever代表一直滚动)
    android:marqueeRepeatLimit="5"

    enabled:设置按钮是否可以点击
    drawableTop:在按钮文字上方加入图片
    drawableBottom
    drawableLeft
    drawableRight
    drawableStart:国际化标准左
    drawableEnd:国际化标准右

      <TextView
                         android:text="QQ邮箱: 1344773678@qq.com    电话: 15116964938   网站:  www.baidu.com"
                         android:textSize="25dp"
                         android:textColor="@android:color/holo_blue_dark"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:autoLink="all"
    
                         />
       
    
                         <Button
                             android:text="这只是个按钮"
                             android:textColor="@android:color/holo_green_light"
                             android:textSize="30dp"
                             android:enabled="false"
                             android:drawableTop="@mipmap/ic_launcher"
                             android:drawableRight="@mipmap/ic_launcher"
                             android:drawableLeft="@mipmap/ic_launcher"
                             android:drawableBottom="@mipmap/ic_launcher"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             />
    
    
                   <Button
                       android:text="er"
                       android:id="@+id/but01"
                       android:layout_width="wrap_content"
                       android:layout_height="wrap_content" />
    
                   <Button
                       android:text="san"
                       android:id="@+id/but02"
                       android:layout_width="wrap_content"
                       android:layout_height="wrap_content" />
    
                     <TextView
                         android:id="@+id/tvshow"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content" />
             

    代码

      @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.layout_textview);
    
            View.OnClickListener click = new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    int id = v.getId();
                    switch (id) {
                        case R.id.but01:
                            tvshow = (TextView) findViewById(R.id.tvshow);
                            tvshow.setText("我来啦一号");
                            break;
                        case R.id.but02:
                            tvshow = (TextView) findViewById(R.id.tvshow);
                            tvshow.setText("我来啦二号");
                            break;
                    }
    
                }
            };
    
            Button button = (Button) findViewById(R.id.but02);
            Button button2 = (Button) findViewById(R.id.but01);
            button.setOnClickListener(click);
            button2.setOnClickListener(click);
    
            // ATTENTION: This was auto-generated to implement the App Indexing API.
            // See https://g.co/AppIndexing/AndroidStudio for more information.
            client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
        }

  • 相关阅读:
    Laravel kalnoy/nestedset
    Eloquent Subquery Enhancements in Laravel 6.0
    Laravel 6.0 中更加强劲的子查询
    Es6系列之module and class
    Using Laravel's Bootable Eloquent Traits
    Google Chrome Shortcut Keys
    另辟蹊径:vue单页面,多路由,前进刷新,后退不刷新
    docker-machine 创建主机的缺省密码 (Default User and Password)
    eslint Cannot read property 'range' of null错误( Quasar Doc )$ quasar dev 出错
    java比较排序Comparable和Comparator
  • 原文地址:https://www.cnblogs.com/xuhaifeng017/p/8252778.html
Copyright © 2011-2022 走看看