layout 相关问题

布局标记用于关于对象相对于包含元素的放置,对齐和对齐的问题。有关CSS的问题,请改用“css”标签。

跨越多列的qt网格布局

我正在尝试创建这个几何图形: _ ___ | | | |1| 3 | |_|___| |_2_| 1 号盒子又高又瘦,2 号盒子又短又宽。我无法完全正确地获得布局。当我取消

回答 1 投票 0

ASP.NET Core Razor 页面 _Layout.cshtml.css 未应用

我偶然发现了 CSS 文件 _Layout.cshtml.css 的问题。好吧,简短而快速的描述,CSS 类“页脚”未被应用。其他 CSS 类,如“border-top”和“text-center”...

回答 2 投票 0

无法向 ScrollView 添加页脚 - Android

我目前正在开发移动应用程序,当我尝试将页脚放在 ScrollView 下时遇到问题。 这是我的代码: 我目前正在开发移动应用程序,当我尝试将页脚放在 ScrollView 下时遇到问题。 这是我的代码: <RelativeLayout android:id="@+id/RelativeLayout01" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <RelativeLayout android:layout_alignParentBottom="true" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/bottomcontent" android:orientation="vertical" android:background="@drawable/border"> //the footer is added dynamically </RelativeLayout> <ScrollView android:layout_weight="1" android:id="@+id/scroller" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/contentcontainer"> <LinearLayout android:id="@+id/scrollcontentcontainer" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> //the content is added dynamically from a layout template </LinearLayout> </LinearLayout> </ScrollView> </RelativeLayout> ScrollView的内容是一组相对布局,里面有一些按钮和文本视图。它基于我多次膨胀的布局。 页脚只是一个 LinearLayout,其中也有一些按钮。 问题是我尝试了在互联网上找到的所有不同的解决方案,但没有一个有效。就我而言,页脚卡在 ScrollView 的内容下方,而不是 ScrollView 本身下方,因此我必须向下滚动,直到内容结束才能到达页脚。但页脚应该保留在屏幕底部...... 我也尝试了这些解决方案,但没有任何效果: http://www.javacodegeeks.com/2013/10/android-fixed-header-and-footer-with-scrollable-content-layout-example.html (当我尝试这个时,我在屏幕顶部有一个页脚,没有其他东西......) http://www.byteslounge.com/tutorials/android-fixed-header-and-footer-with-scrollable-content-layout-example 和其他一些(也不起作用!) 我也尝试了所有可能的东西,比如使用重力、重量、fillViewPort、对齐到底部......但不可能得到预期的结果。 最小API设置为14,我使用Android Studio。 编辑1: 可绘制边框: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:bottom="-2dp" android:left="-2dp" android:right="-2dp" android:top="2dp"> <shape android:shape="rectangle" > <stroke android:width="1dp" android:color="#000000" /> <solid android:color="#3b010101" /> <padding android:left="10dp" android:right="10dp" android:top="10dp" android:bottom="10dp" /> </shape> </item> </layer-list> 您可以尝试以下方法,我在 ScrollView 中添加 RelaveLayout 时也遇到了麻烦。 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent"> <RelativeLayout android:id="@+id/bottomcontent" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="@drawable/border"> <!---add something there eg:--> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Test"/> </RelativeLayout> <ScrollView android:id="@+id/scroller" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="@id/bottomcontent" android:layout_alignParentTop="true"> <LinearLayout android:id="@+id/contentcontainer" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:id="@+id/scrollcontentcontainer" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> </LinearLayout> </LinearLayout> </ScrollView> </RelativeLayout> . 我在本文档中找到了以下内容。这肯定会导致问题 注意:在平台版本 17 及更低版本中,RelativeLayout 受到 一个测量错误,可能会导致子视图被测量 MeasureSpec 值不正确。 (参见MeasureSpec.makeMeasureSpec 更多详细信息。)当relativelayout容器被 放置在滚动容器中,例如 ScrollView 或 水平滚动视图。如果自定义视图未正确配备 使用 MeasureSpec 模式进行测量 UNSPECIFIED 被放置在 relativelayout,无论如何,这都会像relativelayout一样默默地工作 将传递一个非常大的 AT_MOST MeasureSpec 相反。 此行为已为设置的应用程序保留 android:targetSdkVersion="17" 或更旧的清单的使用-sdk 兼容性标记。面向 SDK 版本 18 或更高版本的应用程序将 接受正确的行为

回答 1 投票 0

将图像放入网格中最大宽度/高度内的多个图像的技术?

我已经盯着这个看了大约一个小时,尝试每一种排列如何强制图像调整大小并保持宽高比?但这些都不能解决我的问题。 这是我手动调整大小的两张图片

回答 1 投票 0

如何设置JPanel在屏幕任意位置的位置

我需要有许多 JPanel,但我无法将它们放置在我想要的位置,因为当我尝试更改边界等内容时,它们要么会消失。任何帮助表示赞赏 这是c...

回答 1 投票 0

为什么我无法在 Qt Designer 中的 QStackedWidget 中设置页面布局?

在 Qt 4.8.0 的 Designer 中重现的步骤: 我在 Qt Designer 中创建一个新的对话框表单 我将 QStackedWidget 添加到对话框中 我设置对话框的布局,使堆叠布局大小与...

回答 2 投票 0

有没有办法在SliverAppBar的底部小部件中实现动态高度

SliverAppBar有一个属性bottom,它必须有preferredSize。 现在我让它返回恒定值: ... 新的 SliverAppBar( 扩展高度:_kFlexibleSpaceMaxHeight,

回答 6 投票 0

在哪里放置svelte默认布局模板组件

简介 在 svelte 中,我们知道默认布局存储在 src/routes/+layout.svelte 我也知道有些人使用组布局 src/route/(app)/+layout.svelte 但这不是我要找的......

回答 1 投票 0

在React Native中获取软导航栏的高度

我在React Native中以与屏幕相同的高度渲染内容(Dimensions.get(“window”).height),但是当Android手机具有软导航栏时,某些内容会被隐藏...

回答 3 投票 0

PySide 自定义小部件不会自动适应 QTableWidget

我正在尝试创建一个自定义小部件 RangeSpinBox。该小部件不会自动适应 QTableWidget,如下图所示。 导入系统 从 PySide 导入 QtGui 类 RangeSpinBox(QtGui.QW...

回答 1 投票 0

如何用Tkinter实现复杂的布局?

我想用 Tkinter 实现这个布局,但我不太明白 Tkinter 布局是如何工作的...... 需要布局 页脚有顶部/底部填充,因此高度是“固定的”并且......

回答 1 投票 0

在移动主题上禁用 Magento 扩展/模块

我在 Magento 网站上安装的扩展会覆盖产品页面的 view.phtml 文件,甚至在移动网站上也是如此。我想在浏览时使用移动模板的 view.phtml...

回答 1 投票 0

如何在 Flet 中更新完整布局

在下面的代码中,我创建了一个 Flet 应用程序,其中两个文本控件应根据按钮的点击量更新其数字。为什么这没有发生? 一点背景知识:...

回答 2 投票 0

在 R 中使用布局的问题 - 我想要在热图之上绘制降水图

我是 R 新手,我正在尝试在热图上添加降水趋势线,有人建议我尝试使用布局。 这是我想要实现的目标的一个例子 示例图 我有

回答 1 投票 0

PyQt 添加滚动条到主窗口

这是一个反复出现的问题,我读过很多主题,有些有帮助(python Qt:主小部件滚动条,PyQt:将滚动条放入其中),有些根本没有帮助(PyQt 在我的主窗口中添加滚动条),我

回答 2 投票 0

任何人都可以帮我将此网页内容集中在任何尺寸的屏幕上吗?

我已尽力将此内容集中在网页上,但到目前为止我还无法做到这一点。所以,我想向你们寻求一些帮助。 我希望此内容能够在任何不同的屏幕上居中...

回答 1 投票 0

我在Next js中创建布局文件后无法删除

在这个屏幕截图中,您可以看到我的项目的结构。我正在学习 Next.js。我在博客文件夹内的 [id] 文件夹中创建了一个layout.js 文件,只是为了测试和尝试。然而,从那时起我就已经

回答 1 投票 0

上方布局设置 View.GONE 后,布局下方的视图不可点击

在 searchList 可见性从 VISIBLE 变为 GONE 后,imageView start_messaging 不可单击,即使该片段中只有 recyclerView 中的第一项可单击,但此 b 则不可单击...

回答 1 投票 0

如何禁用特定Tab.Screen的滚动

我正在使用 React Native 和 TypeScript。我正在尝试创建一个顶部选项卡栏并使用权限。当某人无权访问某个选项卡时,该选项卡将被禁用。我已经

回答 1 投票 0

WPF:对齐标签的基线及其文本框

假设我在标签旁边有一个简单的文本框: 我的标签 假设我在标签旁边有一个简单的文本框: <StackPanel> <StackPanel Orientation="Horizontal"> <Label Margin="3">MyLabel</Label> <TextBox Margin="3" Width="100">MyText</TextBox> </StackPanel> ... </StackPanel> 这会产生以下结果: 可以看到,MyLabel 和 MyText 的基线没有对齐,看起来很难看。当然,我可以开始调整边距,直到它们匹配,但由于这是一个常见的要求,我确信 WPF 提供了一个更简单、更优雅的解决方案,只是我还没有找到...... 我认为,这种行为是由于 TextBox 默认为 Stretch 的垂直对齐方式造成的,这导致它填充可用空间并在文本下方有额外的几个像素。如果你用这个代替: <StackPanel> <StackPanel Orientation="Horizontal"> <Label >MyLabel</Label> <TextBox VerticalAlignment="Center" Width="100">MyText</TextBox> </StackPanel> </StackPanel> ...您应该会看到更清晰的结果。 你觉得怎么样? <StackPanel Orientation="Horizontal"> <Label Margin="3" VerticalContentAlignment="Center">MyLabel</Label> <TextBox Margin="3" VerticalContentAlignment="Center" Width="100">MyText</TextBox> </StackPanel> 我在 Kaxaml 中实现了这种外观: <StackPanel Orientation="Horizontal"> <Label Margin="3" VerticalAlignment="Center">MyLabel</Label> <TextBox Margin="3" Width="100" VerticalAlignment="Center">MyText</TextBox> </StackPanel> 我知道这是一个旧的答案,但对于那些寻求另一种方式的人来说,这是一个示例,您不需要依赖固定的文本框宽度: 使用 DockPanel 和 .Dock 代替 StackPanel。 这在网格内使用时被证明非常方便。 <DockPanel Grid.Column="2" Grid.Row="2"> <Label Content="SomeTitle:" DockPanel.Dock="Left"></Label> <TextBox x:Name="SomeValueTextBox" VerticalAlignment="Center" DockPanel.Dock="Right"></TextBox> </DockPanel> 这个问题并不像看起来那么微不足道,并且接受的答案缺乏细节。如果您尝试使用控件自定义高度,您会发现问题。 首先,这是 User7116 回答的正确实现。 <StackPanel Orientation="Horizontal"> <Label Margin="3" VerticalAlignment="Center">MyLabel</Label> <TextBox Margin="3" Width="100" VerticalAlignment="Center">MyText</TextBox> </StackPanel> 棘手的部分是这里有两个级别的垂直对齐,因此请了解对齐的工作原理。 当我们为控件指定对齐方式时,我们是在告诉它如何在 parent 容器中定位自己(请参阅 documentation)。因此,当我们将 VerticalAlignment="Center"> 指定为 TextBox 时,我们告诉它该 TextBox 应在父级 stackpanel 中垂直居中显示。 现在该文本框内的实际文本也可以使用垂直对齐方式在该文本框内!这是第二级,实际上相当棘手,答案见here。 如果您尝试将上面标签的高度也设置为 50,您会发现它们不会再次对齐。这是因为标签现在占据了更大的区域,并且该区域内的文本没有垂直对齐,因此它看起来没有再次对齐。 上面的代码是: <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <Label Margin="3" VerticalAlignment="Center" Height="50">MyLabel</Label> <TextBox Margin="3" VerticalAlignment="Center" Width="50" Height="50">MyText</TextBox> </StackPanel> 幸运的是,当控件高度为默认值时(如标签控件),它的高度足以包含文本,因此内部对齐并不重要。但如果有人为这些控件设置自定义高度,它就会发挥作用,并且更好地理解它是如何工作的。 以下是您可以执行此操作的方法: <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="2"> <Label FontSize="20" Margin="3" FontWeight="Bold">Username :</Label> <TextBox Width="200" Margin="3" Height="40" Name="txtUsername" /> </StackPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="2"> <Label FontSize="20" Margin="3" FontWeight="Bold">Password :</Label> <TextBox Width="200" Margin="3" Height="40" Name="txtPasswrod" /> </StackPanel>

回答 6 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.