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用到。

  • 相关阅读:
    Informatica_(6)性能调优
    Informatica_(5)高级应用
    Informatica_(4)工作流
    Informatica_(3)组件
    Informatica_(2)第一个例子
    Informatica_(1)安装
    Linux_(4)Shell编程(下)
    Linux_(3)Shell编程(上)
    Linux_(2)基本命令(下)
    B
  • 原文地址:https://www.cnblogs.com/hixin/p/4185321.html
Copyright © 2011-2022 走看看