這篇文章將為大家詳細講解有關Android中怎么利用shape呈現出特殊效果,文章內容質量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關知識有一定的了解。
使用到的布局文件
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="#ffffff" android:gravity="center_horizontal"> <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:text="未使用效果" android:layout_marginTop="30dp" /> <EditText android:id="@+id/edit" android:layout_width="280dp" android:layout_height="wrap_content" android:textColor="#000000" android:text="未使用效果 未使用效果 未使用效果 未使用效果 未使用效果 未使用效果" android:cursorVisible="true" /> <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:text="使用效果" android:layout_marginTop="10dp" /> <EditText android:id="@+id/edit2" android:layout_width="280dp" android:layout_height="wrap_content" android:textColor="#000000" android:text="使用效果 使用效果 使用效果 使用效果 使用效果 使用效果 使用效果 使用效果" android:background="@drawable/shape" android:cursorVisible="true" /> </LinearLayout>
使用到的shape文件
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <corners android:radius="10dp" /> <gradient android:startColor="#33CC00" android:endColor="#666600" android:angle="45" /> <padding android:left="5dp" android:top="5dp" android:right="5dp" android:bottom="5dp" /> <stroke android:width="3dp" android:color="#FF3300" /> </shape>
在這里主要說一下shape文件中各項的功能
gradient主要設置背景顏色漸變。startColor為起始顏色值,endColor為結束顏色值,angle為漸變角度
padding主要設置組件里內容距離組件內邊框的間距
stroke主要設置組件的邊框。width為邊框寬度,color為邊框顏色
關于Android中怎么利用shape呈現出特殊效果就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
本文標題:Android中怎么利用shape呈現出特殊效果-創新互聯
文章出自:http://vcdvsql.cn/article40/ccsceo.html
成都網站建設公司_創新互聯,為您提供網站策劃、微信小程序、企業網站制作、虛擬主機、網站內鏈、網站制作
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯