如何在android标题栏中添加按钮

如何在android标题栏中添加按钮,第1张

Android在标题栏加按钮_百度文库

http://wenku.baidu.com/link?url=D93O4XxbjID1hxTF5Y7dhV14mx-aadsaHSSHCSyqzwvr7ug0Rycd-TFy9QVACn91Tzw_rk2LwIb5LDa22DWw4oJbqczrLxMtDTwmq4ew2Gi

Android中标题栏添加按钮

现在很多的Android程序或陆都在标题栏上都显示了一些按钮和标题,如下图:

下面通过实例来段团州看一下如何实现。

1、在layout下创建一个titlebtn.xml文件,内容如下: [html] view plaincopyprint?

1. <?xml version="1.0" encoding="utf-8"?>

2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/andr

oid"

3. android:orientation="horizontal" 4. android:layout_width="fill_parent"握蔽 5. android:layout_height="fill_parent"> 6.

7. <ImageButton

8. android:id="@+id/imageButton1" 9. android:layout_width="wrap_content" 10. android:layout_height="wrap_content" 11. android:background="#00000000" 12. android:layout_centerVertical="true" 13. android:layout_alignParentLeft="true" 14. android:src="@drawable/prv" /> 15.

16. <TextView

17. android:layout_width="wrap_content"

那个应该不是自带的标题,是自定义的标题。汪腊

androidmanifest.xml里困兆滑看一下你引用的theme,在style.xml的你引用的theme标签里添加<item name="android:windowNoTitle">true</item>这一句猜芦去掉自带的标题。然后自定义一个标题就行了


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11982892.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-20
下一篇 2023-05-20

发表评论

登录后才能评论

评论列表(0条)

保存