草庐IT

android - 操作栏和布局重叠

coder 2023-12-26 原文

我在 android 中使用 Actionbar。

在我的布局中,Actionbar 显示正确。但是我的 fragment 布局与 Actionbar 重叠。请参见下图。

我的布局文件在下面。

<RelativeLayout 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/myapp_bg"
tools:context="${relativePackage}.${activityClass}" >

<LinearLayout 
    android:id="@+id/myapp_user_info_container"
    android:layout_width="match_parent"
    android:layout_height="120dp"
    android:orientation="horizontal"
    android:background="@drawable/myapp_profile_bg"

    >
   <RelativeLayout 
       android:id="@+id/myapp_user_info_inner_container"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_marginTop="25dp"
       android:layout_marginBottom="25dp"
       >
       <com.mikhaellopez.circularimageview.CircularImageView
            android:layout_width="@dimen/myapp_circular_image_size"
            android:layout_height="@dimen/myapp_circular_image_size"
            android:layout_gravity="center"
            android:layout_marginLeft="10dp"
            android:src="@drawable/username" />

      <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_marginRight="5dp"
        android:layout_weight="2.30"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/myapp_menu_sidebar_user_mailid"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="1dp"
            android:layout_marginRight="15dp"
            android:layout_marginTop="3dp"
            android:layout_weight="1.15"
            android:gravity="top"
            android:textColor="#ffffff"
            android:textSize="17sp" />

        <TextView
            android:id="@+id/myapp_menu_sidebar_user_info"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="3dp"
            android:layout_marginRight="15dp"
            android:layout_marginTop="1dp"
            android:layout_weight="1.15"
            android:gravity="bottom"
            android:textColor="#ffffff" />
    </LinearLayout>
   </RelativeLayout>

</LinearLayout>

<FrameLayout
    android:id="@+id/myapp_home_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerInParent="true"
    android:layout_marginTop="10dp" 
    android:layout_below="@+id/myapp_user_info_container"
    android:layout_marginBottom="20dp"
    />

<include
   android:id="@+id/myapp_footer_view_id"
   android:layout_width="match_parent"
   android:layout_height="40dp"
   android:layout_alignParentBottom="true"
   layout="@layout/myapp_footer" 
   android:visibility="gone"
   />

<!-- <ProgressBar 
    android:id="@+id/myapp_progressbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    /> -->

我犯了什么错误? 我希望布局将从 ActionBar 下开始。是否需要任何其他细节才能更好地理解?

最佳答案

我认为这可能对您有帮助:

https://developer.android.com/training/basics/actionbar/overlaying.html

主要思想是,如果你正在使用

<item name="windowActionBarOverlay">true</item>

在您的操作栏样式中,您必须手动指定边距:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="?android:attr/actionBarSize">
    ...
</RelativeLayout>

关于android - 操作栏和布局重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29407692/

有关android - 操作栏和布局重叠的更多相关文章

  1. ruby - nanoc 和多种布局 - 2

    是否可以为特定(或所有)项目使用多个布局?例如,我有几个项目,我想对其应用两种不同的布局。一个是绿色的,一个是蓝色的(但是)。我想将它们编译到我的输出目录中的两个不同文件夹中(例如v1和v2)。我一直在玩弄规则和编译block,但我不知道这是怎么回事。因为,每个项目在编译过程中只编译一次,我不能告诉nanoc第一次用layout1编译,第二次用layout2编译。我试过这样的东西,但它导致输出文件损坏。compile'*'doifitem.binary?#don’tfilterbinaryitemselsefilter:erblayout'layout1'layout'layout2'

  2. 安卓apk修改(Android反编译apk) - 2

    最近因为项目需要,需要将Android手机系统自带的某个系统软件反编译并更改里面某个资源,并重新打包,签名生成新的自定义的apk,下面我来介绍一下我的实现过程。APK修改,分为以下几步:反编译解包,修改,重打包,修改签名等步骤。安卓apk修改准备工作1.系统配置好JavaJDK环境变量2.需要root权限的手机(针对系统自带apk,其他软件免root)3.Auto-Sign签名工具4.apktool工具安卓apk修改开始反编译本文拿Android系统里面的Settings.apk做demo,具体如何将apk获取出来在此就不过多介绍了,直接进入主题:按键win+R输入cmd,打开命令窗口,并将路

  3. ruby - 如何使用 Selenium Webdriver 根据 div 的内容执行操作? - 2

    我有一个使用SeleniumWebdriver和Nokogiri的Ruby应用程序。我想选择一个类,然后对于那个类对应的每个div,我想根据div的内容执行一个Action。例如,我正在解析以下页面:https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=puppies这是一个搜索结果页面,我正在寻找描述中包含“Adoption”一词的第一个结果。因此机器人应该寻找带有className:"result"的div,对于每个检查它的.descriptiondiv是否包含单词“adoption

  4. ruby-on-rails - 如何处理 Grape 中特定操作的过滤器之前? - 2

    我正在我的Rails项目中安装Grape以构建RESTfulAPI。现在一些端点的操作需要身份验证,而另一些则不需要身份验证。例如,我有users端点,看起来像这样:moduleBackendmoduleV1classUsers现在如您所见,除了password/forget之外的所有操作都需要用户登录/验证。创建一个新的端点也没有意义,比如passwords并且只是删除password/forget从逻辑上讲,这个端点应该与用户资源。问题是Grapebefore过滤器没有像except,only这样的选项,我可以在其中说对某些操作应用过滤器。您通常如何干净利落地处理这种情况?

  5. ruby-on-rails - 在 Ruby on Rails 中发送响应之前如何等待多个异步操作完成? - 2

    在我做的一些网络开发中,我有多个操作开始,比如对外部API的GET请求,我希望它们同时开始,因为一个不依赖另一个的结果。我希望事情能够在后台运行。我找到了concurrent-rubylibrary这似乎运作良好。通过将其混合到您创建的类中,该类的方法具有在后台线程上运行的异步版本。这导致我编写如下代码,其中FirstAsyncWorker和SecondAsyncWorker是我编写的类,我在其中混合了Concurrent::Async模块,并编写了一个名为“work”的方法来发送HTTP请求:defindexop1_result=FirstAsyncWorker.new.async.

  6. ruby - 在 Ruby 中是否有一种惯用的方法来操作 2 个数组? - 2

    a=[3,4,7,8,3]b=[5,3,6,8,3]假设数组长度相同,是否有办法使用each或其他一些惯用方法从两个数组的每个元素中获取结果?不使用计数器?例如获取每个元素的乘积:[15,12,42,64,9](0..a.count-1).eachdo|i|太丑了...ruby1.9.3 最佳答案 使用Array.zip怎么样?:>>a=[3,4,7,8,3]=>[3,4,7,8,3]>>b=[5,3,6,8,3]=>[5,3,6,8,3]>>c=[]=>[]>>a.zip(b)do|i,j|c[[3,5],[4,3],[7,6],

  7. ruby-on-rails - 如何让 Rails View 返回其关联的操作名称? - 2

    我有一个非常简单的Controller来管理我的Rails应用程序中的静态页面:classPagesController我怎样才能让View模板返回它自己的名字,这样我就可以做这样的事情:#pricing.html.erb#-->"Pricing"感谢您的帮助。 最佳答案 4.3RoutingParametersTheparamshashwillalwayscontainthe:controllerand:actionkeys,butyoushouldusethemethodscontroller_nameandaction_nam

  8. ruby - 查找重叠的正则表达式匹配项 - 2

    我想找到给定字符串中的所有匹配项,包括重叠匹配项。我怎样才能实现它?#Example"a-b-c-d".???(/\w-\w/)#=>["a-b","b-c","c-d"]expected#Solutionwithoutoverlappedresults"a-b-c-d".scan(/\w-\w/)#=>["a-b","c-d"],but"b-c"ismissing 最佳答案 在积极的前瞻中使用捕获:"a-b-c-d".scan(/(?=(\w-\w))/).flatten#=>["a-b","b-c","c-d"]参见Rubyde

  9. ruby - 确定字符串的结尾是否与单独的字符串的开头重叠 - 2

    我想查找字符串的结尾是否与单独字符串的开头重叠。例如,如果我有这两个字符串:string_1='Peoplesaynothingisimpossible,butI'string_2='butIdonothingeveryday.'如何找到string_1末尾的“butI”部分与string_2开头相同?我可以编写一个方法来遍历这两个字符串,但我希望得到一个包含我错过的Ruby字符串方法或Ruby习惯用法的答案。 最佳答案 将MARKER设置为一些从未出现在您的string_1和string_2中的字符串。有一些方法可以动态地做到这一

  10. ruby - 检查 ruby 中的两个范围是否重叠 - 2

    我知道我能做到:(1..30).cover?(2)=>true但是当我尝试对另一个范围执行相同操作时,它总是返回false:(1..30).cover?(2..3)=>false所以我的问题是-是否有任何优雅的方法来比较ruby​​中的两个范围?在我的例子中,我想检查两个日期时间范围是否重叠。提前致谢。 最佳答案 给定范围A的两个范围重叠,当:范围B从范围A开始,范围B在范围A内结束或范围B在范围A之前开始,在范围A之后结束例子:RangeA|-----||-----|Case1|-----|Case2|-|Case1+2|----

随机推荐