android:layout_gravity="bottom",android – 使用layout_gravity =“bottom”放置在LinearLayout的底部...

我想在LinearLayout的底部放置一个布局,但我似乎无法让它工作.我知道我可以使用RelativeLayout来做到这一点,但是我应该能够使用LinearLayout,不应该吗?

编辑:其实这比我想象的更混乱.以下布局简化.实际上,我在3.0之前的设备上使用了兼容性层的片段.

我使用层次查看器来检查发生了什么,并发现一个android.support.v4.app.NoSaveStateFrameLayout被添加到我的布局中,并且该布局的layout_height设置为wrap_content.这似乎是导致我的问题,但我还没有想出如何解决它.

具体来说,为什么这不工作? layout_gravity不应该放在底部吗?

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent">

... stuff here ...

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_gravity="bottom"

android:orientation="horizontal">

... more stuff here ...

将layout_height更改为fill_parent或设置layout_weight的BTW似乎也不起作用.我只是想更好地了解发生了什么,因为显然我错过了一些重要的事情.谢谢.

以下代码,请帮我将Textview修改为一个imageview 。谢谢 。<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:didi="http://schemas.android.com/apk/res-auto" > <com.blog.demo10.NestedViewGroup android:id="@+id/dd_view_group" android:layout_width="match_parent" android:layout_height="match_parent" didi:header_id="@+id/view_bg" didi:target_id="@+id/target_layout" didi:inn_id="@+id/inner_rv" didi:header_init_top="0" didi:target_init_bottom="250"> <TextView android:id="@+id/view_bg" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:textColor="#f00" android:textSize="25sp" android:textAllCaps="false" android:text="@string/txt_nested_scroll_bg" /> <LinearLayout android:id="@+id/target_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:background="#fff"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/inner_rv" android:layout_width="match_parent" android:layout_height="wrap_content"/> </LinearLayout> </com.blog.demo10.NestedViewGroup> <androidx.appcompat.widget.Toolbar android:id="@+id/my_toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" android:elevation="4dp" android:theme="@style/ThemeOverlay.AppCompat.ActionBar" didi:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> </RelativeLayout>
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值