今日學習imageview imagebutton
有關於圖片的顯示 和用圖像來當按鈕
imageview的用法
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ImageScaleActivity"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_scale1"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginTop="5dp"
android:src="@drawable/test"
android:scaleType="centerInside">
</ImageView>
<ImageView
android:id="@+id/iv_scale2"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginTop="5dp">
</ImageView>
</LinearLayout>
imagebutton的用法
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ImageButtonActivity"
android:orientation="vertical">
<ImageButton
android:layout_width="match_parent"
android:layout_height="80dp"
android:src="@drawable/test"
android:scaleType="fitCenter"/>
</LinearLayout>
image元件的scale
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ImageScaleActivity"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_scale1"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginTop="5dp"
android:src="@drawable/test"
android:scaleType="centerInside">
</ImageView>
<ImageView
android:id="@+id/iv_scale2"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginTop="5dp">
</ImageView>
</LinearLayout>
今天的內容就比較簡單了
昨天學習java的部分比較複雜