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

  • 相关阅读:
    监听键盘弹出 隐藏
    状态栏 设置白色字体
    UITextField 属性详解
    支付宝集成SDK 报错
    UIWebView
    app上传 需要的icon
    百度云推送 pem
    百度地图
    info.plist 属性讲解
    静态库 动态库
  • 原文地址:https://www.cnblogs.com/hixin/p/4185321.html
Copyright © 2011-2022 走看看