你现在可以用app:labelVisibilityMode="[labeled, unlabeled, selected, auto] labeled 所有的标签都是可见的. unlabeled 只显示图标. selected 将只显示选定项和移位项的标签. auto 将根据您拥有的项目数选择“标记”或“选定”.标记为1-3项,选择为3+项.…
1.导入BottomNavigationView组件(点击下载按钮,安装组件) 2.新建菜单 (1)app--->src-->main--->res ,选中res目录右击new--->android resource file ,按照如下图设置即可. 注意:File name 可以任意选择,不一定是menu,例如menu_main (2)右击menu->new->Menu Resource file <?xml version="1.0" en…
TabHost控件默认使用LinearLayout包裹TabWidget和FrameLayout,布局文件如下: <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="…
Android自定义底部带有动画的Dialog 效果图 先看效果图,是不是你想要的呢 自定义Dialog package --.view; import android.app.Dialog; import android.content.Context; import android.view.Gravity; import android.view.View; import android.view.Window; import android.view.WindowManager; imp…
创建一个从底部显示的对话框 if (dialog == null) { dialog = new Dialog(context, R.style.theme_from_bottom); View view = View.inflate(context, R.layout.udialog, null); ImageView closeView = view.findViewById(R.id.user_contract_close_view); Button button = view.findV…
记得之前有朋友在留言里让我写一篇关于沉浸式状态栏的文章,正巧我确实有这个打算,那么本篇就给大家带来一次沉浸式状态栏的微技巧讲解. 其实说到沉浸式状态栏这个名字我也是感到很无奈,真不知道这种叫法是谁先发起的.因为Android官方从来没有给出过沉浸式状态栏这样的命名,只有沉浸式模式(Immersive Mode)这种说法.而有些人在没有完全了解清楚沉浸模式到底是什么东西的情况下,就张冠李戴地认为一些系统提供的状态栏操作就是沉浸式的,并且还起了一个沉浸式状态栏的名字. 比如之前就有一个QQ群友问过我…
现在很多android的应用都采用底部导航栏的功能,这样可以使得用户在使用过程中随意切换不同的页面,现在我采用TabHost组件来自定义一个底部的导航栏的功能. 我们先看下该demo实例的框架图: 其中各个类的作用以及资源文件就不详细解释了,还有资源图片(在该Demo中借用了其它应用程序的资源图片)也不提供了,大家可以自行更换自己需要的资源图片.直接上各个布局文件或各个类的代码: [1]  res/layout目录下的 maintabs.xml 源码: <?xml version="1.0…
Android全屏显示: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //去掉Activity的标题栏 // 这句一定要在setContentView的前面 requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_main); //去掉状态栏…
Android之垂直显示TextView 1因为界面需求原因,需要TextView垂直显示,话不多说,看代码,我也是搜的例子,在此感谢写这个例子的大神,在此做个笔记和分享给大家 2.用到了自定义控件的知识,下面就来看看如何自定义的 java代码如下: package com.android.xxx; import android.content.Context; import android.graphics.Canvas;import android.util.AttributeSet;imp…
Android 修改底部导航栏navigationbar的颜色 getWindow().setNavigationBarColor(Color.BLUE); //写法一 getWindow().setNavigationBarColor(getResources().getColor(R.color.black_12));//写法二…