今天搞了很久的一个问题,导航菜单没有固定到底部,因为上面是ListView,可是没内容,于是就浮动上去了。

效果如下:

这里采用的是一个碎片,代码是:

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
> <TextView
android:id="@+id/card_title_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_card"
android:gravity="center"
android:textSize="18sp"/> <ListView
android:id="@+id/jonrney_list_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="48dp"
/>
</LinearLayout>

出问题了,百度了很多,试了很多的办法,没用。

主页面代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tl="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#eeeeee"
android:scrollbars="none"
> <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--android:background="@color/colorPrimaryDark"-->
<!--内容-->
<FrameLayout
android:id="@+id/fl_change"
android:layout_weight=""
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
>
</FrameLayout>
<!-- <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/bottom"
android:layout_alignParentBottom="true" >-->
<!--底部-->
<com.flyco.tablayout.CommonTabLayout
android:id="@+id/tl_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tl:tl_indicator_gravity="TOP"
tl:tl_indicator_color="#2C97DE"
tl:tl_textSelectColor="#2C97DE"
tl:tl_textUnselectColor="#66000000"
tl:tl_underline_height="2dp"/>
<!-- </LinearLayout>-->
<!--android:layout_alignParentBottom="true"-->
</LinearLayout>
</android.support.constraint.ConstraintLayout >

最后发现是这段代码惹的麻烦:android:layout_height="wrap_content"

也是自己对这个属性没有了解清楚,不知道从哪里copy来的一个代码,这个属性代码自动浮动,根据内容更改大小。所以就造成了我现在的情况。

所以改成:android:layout_height="match_parent" 就好了。

												

Android 底部菜单固定到底部的更多相关文章

  1. 解决 scroll() position:fixed 抖动、导航菜单固定头部(底部)跟随屏幕滚动

    一.导航栏或者页脚正常情况下固定在页面的相应位置,当页面滚动后,导航栏或者页脚固定在页面的顶部或者底部的情景 一般就是将该块的代码样式的position设置为fixed.固定在顶部的话,将top设置为 ...

  2. Android底部菜单的实现

    前言:以前制作菜单使用TabHost,但是android 3.0以上就被废弃了,google已经不建议使这个类了.ActionBar也是菜单,不过在头部,算是导航了 ===本文就介绍怎么制作底部菜单= ...

  3. Xamarin.Android 解决打开软键盘导致底部菜单上移问题

    在界面布局中有EditText控件,该控件一旦获取焦点则打开软键盘,如果布局中有底部菜单,那么底部菜单可能会被软键盘顶在其上面,看如下效果: 解决方法:在活动绑定界面之前写上下段代码即可 Window ...

  4. Android应用主界面底部菜单实现

    介绍 现在绝大多数主流的应用主界面,都会包含一个底部菜单,就拿腾讯的QQ与微信来说,看起来是这样的  <---我是底部菜单 原理 在很久以前,可以通过TabActivity实现相关功能,自从Fr ...

  5. Android自定义控件系列(四)—底部菜单(下)

    转载请注明出处:http://www.cnblogs.com/landptf/p/6290862.html 在app中经常会用到底部菜单的控件,每次都需要写好多代码,今天我们用到了前几篇博客里的控件来 ...

  6. Android中软键盘弹出时底部菜单上移问题

    当在Android的layout设计里面如果输入框过多,则在输入弹出软键盘的时候,下面的输入框会有一部分被软件盘挡住,从而不能获取焦点输入. 解决办法: 方法一:在你的activity中的oncrea ...

  7. [Android] Android 使用 FragmentTabHost + Fragment 实现 微信 底部菜单

    Android 使用 FragmentTabHost + Fragment 实现 微信 底部菜单 利用FragmentTabHost实现底部菜单,在该底部菜单中,包括了4个TabSpec,每个TabS ...

  8. Xamarin.Android 利用Fragment实现底部菜单

    效果图: 第一步:添加引用 引用 Crosslight.Xamarin.Android.Support.v7.AppCompat 这个包. 第二步:绘制Main和Fragment界面 fg_home. ...

  9. [Android] Android 让UI控件固定于底部的几种方法

    Android 让UI控件固定于底部的几种方法1.采用linearlayout布局:android:layout_height="0dp" <!-- 这里不能设置fill_p ...

随机推荐

  1. Spring Boot加载配置文件

    问题1:Spring如何加载配置,配置文件位置? 1.默认位置: Spring Boot默认的配置文件名称为application.properties,SpringApplication将从以下位置 ...

  2. list、map、数组 转换

    list,set,map,数组间的相互转换1.list转setSet set = new HashSet(new ArrayList()); 2.set转listList list = new Arr ...

  3. 在JSP中如何使用JavaBean

    在JSP中使用JavaBean以后,可以实现HTML代码和Java代码的分离,是JSp更易于开发和维护.因此JavaBean成了JSP程序员必备的利器.虽然javaBean是java类,但是它也有自己 ...

  4. Groovy 学习手册(7)

    10. Groovy GPars GPars 一开始在 Groovy 中作为一个单独的项目,同时带来了很多并发的机制.它包含了很多并行的map/redue,Actors,以及其他很多并发的模块. 1. ...

  5. PostgreSQL创建数据库用户

    注:版本不同,命令的执行路径可能有些不同. 一. 创建数据库用户freeswitch sudo -u postgres /usr/pgsql-9.5/bin/createuser -s -e free ...

  6. Javascript MVC 学习笔记(一) 模型和数据

    写在前面 近期在看<MVC的Javascript富应用开发>一书.本来是抱着一口气读完的想法去看的.结果才看了一点就傻眼了:太多不懂的地方了. 仅仅好看一点查一点,一点一点往下看吧,进度虽 ...

  7. 使用base64编码的好处

    在项目中,将报文进行压缩.加密后,最后一步必然是使用base64编码,因为base64编码的字符串,更适合不同平台.不同语言的传输: 它不受其他编码的影响,仍然保持不变,这点很有意义,如下验证: St ...

  8. 水晶报表填充.Net Objects数据源

    Crystal Reports(水晶报表)是一款商务智能(BI)软件,主要用于设计及产生报表.是业内最专业.功能最强的报表系统. 查看网络资料及课本图书,鲜有介绍通过.NET Objects作为数据源 ...

  9. [转]session和cookie的区别和联系,session的生命周期,多个服务部署时session管理

    Session和Cookie的区别 对象 信息量大小 保存时间 应用范围 保存位置 Session 小量,简单的数据 用户活动时间+一段延迟时间(一般为20分钟) 单个用户 服务器端 Cookie 小 ...

  10. Excel Open Xml中CellStyleXfs,cellStyle,cellXfs之间关系的总结

    最近这几个东东打交道了几天,总算是弄明白了,综合多个帖子,现在总结如下: 在创建stylesheet时,必须创建fonts,Fills,Borders 和cellXfs(CellFormats)四个节 ...