Android-图片按钮汇总

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.hanqi.testapp2.TestActivity1"
android:orientation="vertical"> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/anniu04"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/anniu05"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/anniu04"
android:text="普通按钮"/>
</LinearLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/yuantu"
android:alpha="1"
android:background="#f00"
android:scaleType="center"/>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/yuantu"
android:alpha="1"
android:background="#f00"
android:scaleType="centerCrop"/>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/yuantu"
android:alpha="1"
android:background="#f00"
android:scaleType="centerInside"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/yuantu"
android:alpha="1"
android:background="#f00"
android:scaleType="matrix"/>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/yuantu"
android:alpha="1"
android:background="#f00"
android:scaleType="fitCenter"/> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/yuantu"
android:alpha="1"
android:background="#f00"
android:scaleType="fitStart"/>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/yuantu"
android:alpha="1"
android:background="#f00"
android:scaleType="fitEnd"/> <ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/yuantu"
android:alpha="1"
android:background="#f00"
android:scaleType="fitXY"/>
</LinearLayout>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="男"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="女"/>
</RadioGroup>
</LinearLayout>
 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.administrator.testapp2"> <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".TestActivity1">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </manifest>
 package com.example.administrator.testapp2;

 import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; public class TestActivity1 extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test1);
}
}
上一篇:安装apk到虚拟的device


下一篇:python import引入不同路径下的模块