更新时间:2022-09-10 11:00:22
引用:http://www.eoeandroid.com/thread-173761-1-1.html
PopupWindow的布局popwindow.xml
注意3个LinearLayout里必须设置clickable和background,这样当点击上去的时候才会有点击效果
。
android:clickable="true"
android:background="@drawable/state_btn_pressed"
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
<?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= "wrap_content"
android:orientation= "horizontal"
android:id= "@+id/layout_main"
> <LinearLayout android:layout_width= "fill_parent"
android:layout_height= "wrap_content"
android:orientation= "vertical"
android:gravity= "center_horizontal"
android:clickable= "true"
android:background= "@drawable/state_btn_pressed"
android:layout_weight= "1"
android:id= "@+id/btn_0"
> <ImageView android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:scaleType= "fitCenter"
android:src= "@drawable/ic_call"
> </ImageView> <TextView android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:textColor= "#000000"
android:textSize= "18px"
android:text= "电话" >
</TextView> </LinearLayout> <LinearLayout android:layout_width= "fill_parent"
android:layout_height= "wrap_content"
android:orientation= "vertical"
android:gravity= "center_horizontal"
android:clickable= "true"
android:background= "@drawable/state_btn_pressed"
android:layout_weight= "1"
android:id= "@+id/btn_1"
> <ImageView android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:scaleType= "fitCenter"
android:src= "@drawable/ic_home"
> </ImageView> <TextView android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:textColor= "#000"
android:textSize= "18px"
android:text= "空间" >
</TextView> </LinearLayout> <LinearLayout android:layout_width= "fill_parent"
android:layout_height= "wrap_content"
android:orientation= "vertical"
android:gravity= "center_horizontal"
android:clickable= "true"
android:background= "@drawable/state_btn_pressed"
android:layout_weight= "1"
android:id= "@+id/btn_2"
> <ImageView android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:scaleType= "fitCenter"
android:src= "@drawable/ic_sms"
> </ImageView> <TextView android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:textColor= "#000"
android:textSize= "18px"
android:text= "短信"
> </TextView> </LinearLayout> </LinearLayout> |
state_btn_pressed.xml,点击的效果:
01
02
03
04
05
06
|
<?xml version= "1.0" encoding= "utf-8" ?>
<selector xmlns:android= "http://schemas.android.com/apk/res/android" >
<item android:state_pressed= "true"
android:drawable= "@drawable/bg_btn_pressed"
android:padding= "0dp" />
</selector> |
1、android图片浏览器 PhotoStore
下载地址 http://www.eoeandroid.com/thread-176574-1-1.html
2、仿QQ--tab切换动画实例
下载地址 http://www.eoeandroid.com/thread-173365-1-1.html
3、基本控件及基本动画效果demo
下载地址 http://www.eoeandroid.com/thread-173358-1-1.html
4、Activity跳转页面切换漂亮效果
下载地址 http://www.eoeandroid.com/thread-173334-1-1.html
5、Android瀑布流加载图片效果实例
下载地址http://www.eoeandroid.com/thread-176638-1-1.html