Flat Button簡單製作

2021-06-26 06:07:48 字數 1799 閱讀 7954

建立 colors.xml 檔案定義兩個顏色

name

="blue_pressed"

>

@android:color/holo_blue_dark

name

="blue_normal"

>

@android:color/holo_blue_light

我們這裡使用android的 holo 色調:

name

="holo_blue_dark"

>

#ff0099cc

name

="holo_blue_light"

>

#ff33b5e5

建立 dimen.xml 檔案,定義圓角值和陰影高度,見下圖

name

="corner_radius"

>

4dpname

="layer_padding"

>

3dp<

我們用shape來定義按鈕背景 建立rect_pressed.xml 的 drawable 檔案

xmlns:android

=""android:shape

="rectangle"

>

android:radius

="@dimen/corner_radius"

/>

android:color

="@color/blue_pressed"

/>

建立rect_normal.xml

file 的drawable 檔案。

xmlns:android

="">

android:drawable

="@drawable/rect_pressed"

/>

android:bottom

="@dimen/layer_padding"

>

android:shape

="rectangle"

>

android:radius

="@dimen/corner_radius"

/>

android:color

="@color/blue_normal"

/>

為按鈕定義 selector . 建立flat_selector.xml 檔案。

xmlns:android

="">

android:state_pressed

="true"

android:drawable

="@drawable/rect_pressed"

/>

android:drawable

="@drawable/rect_normal"

/>

定義 button 設定 background 為 flat_selector.

android:layout_width

="fill_parent"

android:layout_height

="wrap_content"

android:background

="@drawable/flat_selector"

android:textcolor

="@android:color/white"

android:text

="say hello"

/>

簡單外掛程式製作

外掛程式的實現方法有很多種 裡只說說其中的一種比較簡單的方法.1.啟動遊戲 2.得到程式的進的id 比較常用的方法有findwindow 得到視窗的控制代碼,更進一步你可以得到程序id,但是對於例如連連看一樣的遊戲而言,得到視窗的控制代碼就已經足夠了。其中值得注意的是,findwindow 裡面的引...

簡單影子製作

思路 通過攝像機單獨渲染需要製作影子的模型,並渲染到乙個plane上 1 給模型a建立層model,並把model層設定給a 2 新建相機,設定clearflag為solidcolor,cullingmask設定為model,新建rendertexture並設定給相機的目標texture 3 新建p...

簡單網頁課表製作

課程表節次星期一星期二 星期三期期四 星期五星期六 星期日 第一大 節第一節 高等數學a 一 樓 4 9週上 1 2節 大學英語 三 樓 4 18週上 1 2節 體育 一 00007001 09 虛擬操場1 詳見清單6 高等數學a 一 樓 4 19週上 1 2節 第二節 第二大節 第三節 高等數學a...