温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何实现底部工具栏的位置在屏幕底部

发布时间:2020-06-03 17:55:43 来源:网络 阅读:1859 作者:孙洪波 栏目:移动开发

一个垂直方向的LinearLayout,包含两个View。下面一个View(工具栏)固定在屏幕底部,上面的View占据剩余的屏幕空间。

    <LinearLayout
        android:orientation="vertical"
        android:id="@+id/vertical_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <FrameLayout android:id="@+id/main_content"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
         />
        
        <FrameLayout android:id="@+id/fixed_bottombar_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
        />
    </LinearLayout>


android:layout_height="0dp" <!-- 这里不能设置fill_parent -->
android:layout_weight="1" <!-- 这里设置layout_weight=1是最关键的,否则底部的LinearLayout无法到底部 -->

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI