Android-图片按钮汇总
2020-01-15 11:34
309 查看
1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:tools="http://schemas.android.com/tools" 4 android:layout_width="match_parent" 5 android:layout_height="match_parent" 6 android:paddingBottom="@dimen/activity_vertical_margin" 7 android:paddingLeft="@dimen/activity_horizontal_margin" 8 android:paddingRight="@dimen/activity_horizontal_margin" 9 android:paddingTop="@dimen/activity_vertical_margin" 10 tools:context="com.hanqi.testapp2.TestActivity1" 11 android:orientation="vertical"> 12 13 <LinearLayout 14 android:layout_width="match_parent" 15 android:layout_height="wrap_content"> 16 <ImageButton 17 android:layout_width="wrap_content" 18 android:layout_height="wrap_content" 19 android:src="@drawable/anniu04"/> 20 <ImageButton 21 android:layout_width="wrap_content" 22 android:layout_height="wrap_content" 23 android:src="@drawable/anniu05"/> 24 <Button 25 android:layout_width="wrap_content" 26 android:layout_height="wrap_content" 27 android:background="@drawable/anniu04" 28 android:text="普通按钮"/> 29 </LinearLayout> 30 31 <LinearLayout 32 android:layout_width="match_parent" 33 android:layout_height="wrap_content"> 34 <ImageView 35 android:layout_width="100dp" 36 android:layout_height="100dp" 37 android:src="@drawable/yuantu" 38 android:alpha="1" 39 android:background="#f00" 40 android:scaleType="center"/> 41 <ImageView 42 android:layout_width="100dp" 43 android:layout_height="100dp" 44 android:src="@drawable/yuantu" 45 android:alpha="1" 46 android:background="#f00" 47 android:scaleType="centerCrop"/> 48 <ImageView 49 android:layout_width="100dp" 50 android:layout_height="100dp" 51 android:src="@drawable/yuantu" 52 android:alpha="1" 53 android:background="#f00" 54 android:scaleType="centerInside"/> 55 </LinearLayout> 56 <LinearLayout 57 android:layout_width="match_parent" 58 android:layout_height="wrap_content"> 59 <ImageView 60 android:layout_width="100dp" 61 android:layout_height="100dp" 62 android:src="@drawable/yuantu" 63 android:alpha="1" 64 android:background="#f00" 65 android:scaleType="matrix"/> 66 <ImageView 67 android:layout_width="100dp" 68 android:layout_height="100dp" 69 android:src="@drawable/yuantu" 70 android:alpha="1" 71 android:background="#f00" 72 android:scaleType="fitCenter"/> 73 74 </LinearLayout> 75 <LinearLayout 76 android:layout_width="match_parent" 77 android:layout_height="wrap_content"> 78 <ImageView 79 android:layout_width="100dp" 80 android:layout_height="100dp" 81 android:src="@drawable/yuantu" 82 android:alpha="1" 83 android:background="#f00" 84 android:scaleType="fitStart"/> 85 <ImageView 86 android:layout_width="100dp" 87 android:layout_height="100dp" 88 android:src="@drawable/yuantu" 89 android:alpha="1" 90 android:background="#f00" 91 android:scaleType="fitEnd"/> 92 93 <ImageView 94 android:layout_width="100dp" 95 android:layout_height="100dp" 96 android:src="@drawable/yuantu" 97 android:alpha="1" 98 android:background="#f00" 99 android:scaleType="fitXY"/> 100 </LinearLayout> 101 <RadioGroup 102 android:layout_width="match_parent" 103 android:layout_height="wrap_content"> 104 <RadioButton 105 android:layout_width="wrap_content" 106 android:layout_height="wrap_content" 107 android:text="男"/> 108 <RadioButton 109 android:layout_width="wrap_content" 110 android:layout_height="wrap_content" 111 android:text="女"/> 112 </RadioGroup> 113 </LinearLayout>
1 <?xml version="1.0" encoding="utf-8"?> 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 3 package="com.example.administrator.testapp2"> 4 5 <application 6 android:allowBackup="true" 7 android:icon="@mipmap/ic_launcher" 8 android:label="@string/app_name" 9 android:supportsRtl="true" 10 android:theme="@style/AppTheme"> 11 <activity android:name=".TestActivity1"> 12 <intent-filter> 13 <action android:name="android.intent.action.MAIN" /> 14 <category android:name="android.intent.category.LAUNCHER" /> 15 </intent-filter> 16 </activity> 17 </application> 18 19 </manifest>
1 package com.example.administrator.testapp2; 2 3 import android.support.v7.app.AppCompatActivity; 4 import android.os.Bundle; 5 6 public class TestActivity1 extends AppCompatActivity { 7 8 @Override 9 protected void onCreate(Bundle savedInstanceState) { 10 super.onCreate(savedInstanceState); 11 setContentView(R.layout.activity_test1); 12 } 13 }
转载于:https://www.cnblogs.com/TENOKAWA/p/5464123.html
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- android图片显示循环与多选按钮
- android 点击一个按钮,选择一张图片,获取路径,然后显示在屏幕
- Android 调用系统功能实现图片选择器,你可能会遇到的问题汇总
- Android中的ListView实现图片文字和按钮
- 【Android开发】范例1-实现跟踪鼠标单击状态的图片按钮
- Android Nine Patch图片及按钮背景
- Android图片文字按钮
- jar包中含有Android图片文件以及按钮等selector.xml的替代方案
- android 图片按钮
- Android RadioButton按钮,点击换图片。
- Android自定义圆形图片按钮
- Android点击换图片和换字的颜色相互点按钮
- Android笔记--一个图片+文字的自定义按钮
- Android开发之带图片的按钮
- Android在用canvas绘图时自定义图片按钮
- Android Nine Patch图片及按钮背景
- Android开发_如何设置按钮背景透明与半透明_图片背景透明
- Android开发_如何设置按钮背景透明与半透明_图片背景透明
- android 通知栏如何更新图片、按钮
- android 读取sd卡(sdcard)图片设置为按钮背景(Button背景设置)代码