展会信息港展会大全

Android状态栏上添加按钮
来源:互联网   发布日期:2015-12-04 16:25:00   浏览:3652次  

导读:修改xml文件就可以添加按钮,文件位置/frameworks/base/core/res/res/layout/status_bar.xmlcom.android.server.status.StatusBarViewxmlns:android=http://schemas.android.com/apk/res/androidandroid:back......

修改xml文件就可以添加按钮,文件位置/frameworks/base/core/res/res/layout/status_bar.xml

<com.android.server.status.StatusBarView

xmlns:android="http://schemas.android.com/apk/res/android"

android:background="@drawable/statusbar_background"

android:orientation="vertical" android:focusable="true"

android:descendantFocusability="afterDescendants">

<LinearLayout

android:id="@+id/icons"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="horizontal">

<!-- 开始:这里是添加的3个按钮 -->

<LinearLayout

android:id="@+id/statusButtons"

android:layout_width="wrap_content"

android:layout_height="fill_parent"

android:layout_alignParentRight="true"

android:orientation="horizontal">

<ImageButton

android:id="@+id/Stat_Home_button"

android:layout_width="wrap_content"

android:layout_height="fill_parent"

android:background="@drawable/stat_home_button"

/>

<ImageButton

android:id="@+id/Stat_vol_down_button"

android:layout_width="wrap_content"

android:layout_height="fill_parent"

android:background="@drawable/stat_volume_down_button_up"

/>

<ImageButton

android:id="@+id/Stat_vol_raise_button"

android:layout_width="wrap_content"

android:layout_height="fill_parent"

android:background="@drawable/stat_volume_raise_button_up"

/>

</LinearLayout>

<!-- 结束:这里是添加的3个按钮 -->

<com.android.server.status.IconMerger

android:id="@+id/notificationIcons"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="fill_parent"

android:layout_alignParentLeft="true"

android:paddingLeft="6dip"

android:gravity="center_vertical"

android:orientation="horizontal"

/>

<LinearLayout

android:id="@+id/statusIcons"

android:layout_width="wrap_content"

android:layout_height="fill_parent"

android:layout_alignParentRight="true"

android:paddingRight="6dip"

android:gravity="center_vertical"

android:orientation="horizontal"

/>

</LinearLayout>

<LinearLayout

android:id="@+id/ticker"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:paddingLeft="6dip"

android:animationCache="false"

android:orientation="horizontal">

<ImageSwitcher

android:id="@+id/tickerIcon"

android:layout_width="wrap_content"

android:layout_height="fill_parent"

android:layout_marginRight="8dip">

<com.android.server.status.AnimatedImageView

android:layout_width="25dip"

android:layout_height="25dip"

/>

<com.android.server.status.AnimatedImageView

android:layout_width="25dip"

android:layout_height="25dip"

/>

</ImageSwitcher>

<com.android.server.status.TickerView

android:id="@+id/tickerText"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"

android:paddingTop="2dip"

android:paddingRight="10dip">

<TextView

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:singleLine="true"

android:textColor="#ff000000"

/>

<TextView

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:singleLine="true"

android:textColor="#ff000000"

/>

</com.android.server.status.TickerView>

</LinearLayout>

<com.android.server.status.DateView

android:id="@+id/date"

android:layout_width="wrap_content"

android:layout_height="25dp"

android:singleLine="true"

android:textSize="16sp"

android:textStyle="bold"

android:gravity="center_vertical|left"

android:paddingLeft="6px"

android:paddingRight="6px"

android:textColor="#ff000000"

android:background="@drawable/statusbar_background"

/>

</com.android.server.status.StatusBarView>

效果如下:

赞助本站

人工智能实验室

相关热词: 状态栏 按钮

AiLab云推荐
推荐内容
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港