zoukankan      html  css  js  c++  java
  • Android ImageView

      

    如上图,drawable中不只是可以放bitmap  还可以定制不同形状

    1 <?xml version="1.0" encoding="utf-8"?>
    2 <shape xmlns:android="http://schemas.android.com/apk/res/android" >
    3     <!-- 圆角矩形实形 -->
    4     <corners android:radius="50dp"/>
    5    <!--实体颜色 -->   
    6     <solid android:color="#336699"/>
    7 
    8 </shape>

    然后到layout中布局ImageView

     1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     2     android:layout_width="match_parent"
     3     android:layout_height="match_parent"
     4     android:orientation="vertical" >
     5     
     6     <TextView 
     7         android:layout_width="match_parent"
     8         android:layout_height="wrap_content"
     9         android:layout_margin="20dp"
    10         android:padding="10dp"
    11         android:gravity="center"
    12         android:background="@drawable/btn"
    13         android:text="登录"
    14         android:textColor="@android:color/white"/>
    15 
    16     <EditText
    17         android:layout_width="match_parent"
    18         android:layout_height="wrap_content"
    19         android:padding="10dp"
    20         android:text="111"/>
    21     <!-- 去掉默认的background或者button    @null -->
    22      <EditText
    23         android:layout_width="match_parent"
    24         android:layout_height="wrap_content"
    25         android:background="@null"
    26         android:padding="10dp"
    27         android:text="222"/>
    28      <!-- 画一根线 -->
    29      <View
    30          android:layout_width="match_parent"
    31          android:layout_height="3px"
    32          android:layout_margin="5dp"
    33          android:background="@android:color/darker_gray"/>
    34      
    35      <!-- android:src="@drawable/about" 引用图片资源 -->
    36      <!-- android:adjustViewBounds="true"  拉伸按原图宽高比 -->
    37      <!--android:scaleType="fitXY" 拉伸图片 -->
    38      <ImageButton
    39          android:layout_width="match_parent"
    40          android:layout_height="wrap_content"
    41          android:background="@null"
    42          android:src="@drawable/about"
    43          android:adjustViewBounds="true"
    44          android:scaleType="fitXY"/>
    45     
    46 </LinearLayout>

    效果图如下:

  • 相关阅读:
    configuring express for ejs
    if else in EJS
    nodegroupchat exercise
    heap&stack 区别
    如何构建积木式Web应用(引自微软CSDN )
    Configuring IIS: Mapping .* to the aspnet_isapi.dll
    递归遍历XML生成树
    数据库应用:无法更新到数据库
    C#中HashTable的用法
    如何使用Eclipse编译C,C++,JAVA程序
  • 原文地址:https://www.cnblogs.com/Claire6649/p/5914161.html
Copyright © 2011-2022 走看看