tab按下效果,使用LinearLayout + ImageView.和LinearLayout + Button
来源:互联网 发布:java 环形链表 编辑:程序博客网 时间:2024/06/05 07:08
tab按下效果时要使用使用LinearLayout + ImageView.
LinearLayout 注意要加 android:clickable="true" 属性,
tab 上小图标用 ImageView(如果用Button的话,点了bottom LinearLayout 就没响应 ,原理其简单。当然button做大点 给按钮做selector 也是一种方式 )
drawable/home_tab_bar_pressed.xml
<?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/home_tab_bg_pressed" />
<item android:state_focused="true" android:state_pressed="false"
android:drawable="@drawable/home_tab_bg_pressed" />
<item android:drawable="@drawable/home_tab_bar_bg" />
</selector>
<LinearLayout
android:id="@+id/tab_1"android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/home_tab_bar_pressed"
android:clickable="true"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="7dip"
android:paddingTop="9dip" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_chat_bubble"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="消息"
android:textColor="#666666"
android:textSize="12sp" />
</LinearLayout>
0 0
- tab按下效果,使用LinearLayout + ImageView.和LinearLayout + Button
- 解决LinearLayout或ImageView设置按下效果不起作用,无效果
- LinearLayout模仿Button点击动态缩放效果
- Android linearlayout实现button的点击效果
- 动态创建布局LinearLayout和ImageView
- LinearLayout布局下Button按钮不可见
- LinearLayout 使用
- LinearLayout和RelativeLayout的使用
- LinearLayout+Fragment实现下导航栏效果
- LinearLayout
- LinearLayout
- Linearlayout
- LinearLayout
- LinearLayout
- LinearLayout
- Linearlayout
- LinearLayout
- LinearLayout
- Android EventBus实战
- DOS下的加减运算
- 理解JavaScript中的事件路由冒泡过程及委托代理机制
- mysql日志打印
- 用R画有图例的中国地图
- tab按下效果,使用LinearLayout + ImageView.和LinearLayout + Button
- 数据库连接池C3P0学习
- Spring +Struts2+ibatis 整合细节
- windows shell
- Webdriver - how to view log(grid mode)
- Android的四种启动模式
- Python 中调用函数的Docstring
- pat 1079. Total Sales of Supply Chain(树模拟)
- Nginx中队列使用学习