先创建一个title.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ic_launcher_foreground"
>
<!--background可以放图片,放了合适的图片比较好看,这里我比较随意点,没找到资源-->
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/title_Back"
android:layout_margin=

本文介绍了在Android开发中如何创建自定义布局title.xml,并展示了在activity_main.xml中调用该布局的方法,以此来实现类似iPhone标题栏的效果。通过自定义布局,可以方便地复用组件并定制UI。
最低0.47元/天 解锁文章
1124

被折叠的 条评论
为什么被折叠?



