引用: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


更多相关文章

  1. 给Activity切换加入动画
  2. 圆形button
  3. 关于Android(安卓)ListView组件中android:drawSelectorOnTop含义
  4. android ndk编译x264开源(用于android的ffmpeg中进行软编码)
  5. 第一个android程序以及遇到问题解决办法
  6. TextView 设置背景【点击或获得焦点改变背景】
  7. Android(安卓)API 中文(76)——AdapterView.OnItemLongClickListen
  8. GitHub 优秀的 Android(安卓)开源项目
  9. 【Android(安卓)UI设计与开发】第14期:顶部标题栏(五)两种方式实现

随机推荐

  1. 下载好自动安装
  2. PopWindow 自定义
  3. RecyclerView的canScrollVertically方法
  4. RadioButton+FrameLayout+Fragment实现底
  5. Property Anim详解
  6. 使用DatePicker以及TimePicker显示当前日
  7. Android(安卓)AlertDialog 获取PositiveB
  8. 多选一机制的实现(RadioButton的实现)
  9. 地图的使用 GoogleMapAPI
  10. Android有趣的开源框架