zoukankan      html  css  js  c++  java
  • textView布局的一点体会

     1 <?xml version="1.0" encoding="utf-8"?>
     2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     3     android:layout_width="match_parent"
     4     android:layout_height="match_parent"
     5     android:orientation="horizontal" >
     6     <ImageView android:id="@+id/img"
     7         android:layout_width="80dp"
     8         android:layout_height="80dp"
     9         android:background="#00000000"
    10         android:scaleType="fitCenter"
    11         android:layout_margin="10dp"/>
    12    
    13     <TextView android:id="@+id/name"   
    14         android:textSize="40sp"
    15         android:gravity="center_vertical"
    16         android:layout_width="match_parent"
    17         android:layout_height="match_parent"/>
    18      
    19 </LinearLayout>

    listview的item,必须使用 android:layout_width="match_parent"
            android:layout_height="match_parent"/>

    gravity才生效

    ImageButton 是带图标的Button控件,有src的属性,也就是设置他的图标,也有一个所有控件公有的属性background, 这个也可以设置它的“图标”。
    其实,src才是设置图标,而background只是设置背景。
    如果控件的大小是100*100 图片资源是80*80的话,那么用src,图片就会居中显示,如果使用background那么图片就会被拉伸充满控件。
    重要的是,background是底层的图片资源,src是覆盖在background上面的资源,他们可以叠加使用,实现选中的效果。在ActivityGroup用到。

  • 相关阅读:
    C# is 与 as 运算符
    C# dynamic类型
    C# 数组
    C# 泛型
    C# 事件
    C# 委托
    C# DateTime类,TimeSpan类
    C# 获取当前应用程序的绝对路径支持asp.net
    C# 父子类_实例_静态成员变量_构造函数的执行顺序
    C# System.Uri类_获取Url的各种属性_文件名_参数_域名_端口等等
  • 原文地址:https://www.cnblogs.com/hixin/p/4185321.html
Copyright © 2011-2022 走看看