问题标签 [android-relativelayout]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
5 回答
47984 浏览

android - RelativeLayout 比 LinearLayout 贵吗?

每次我需要一个 View 容器时,我总是使用 RelativeLayout,因为它很灵活,即使我只是想显示一些非常简单的东西。

从性能/良好实践的角度来看,这样做可以吗,或者我应该尝试使用 LinearLayout 吗?

谢谢!

0 投票
1 回答
8010 浏览

android - 关于右下角对齐图像

我正在使用相对布局将一个较小的图像叠加在一个较大的图像之上。我希望较小图像的右下角与较大图像的 BR 角重合。我在我的布局 XML 中使用边距参数(指定倾角测量值),但这似乎不适用于所有设备和分辨率 - 在某些情况下,小图像从边框移动了 4-5px。

是否可以在没有像素值的情况下指定较小图像的位置?即重力还是什么?

0 投票
1 回答
11889 浏览

android - 如何使用 XML 文件在 Android 中的另一个 TextView 下方显示一个 TextView?

我很确定一个参数可以解决问题,但我找不到我要找的那个。

我正在尝试在 file_title TextView 下方显示一个 TextView -file_type-。

我应该添加到 file_type TevxtView 块以位于 file_title TextView 块下的参数是什么?

我正在做的是:

谢谢 ,

0 投票
1 回答
1519 浏览

android - relativelayout xml 上的微调器问题

我正在做一个 xml 布局文件,我想让我的微调器位于 textview 的右侧,但是我遇到了问题......当我测试布局时,我的微调器不在正确的位置,它有点向下而且它的长度非常小,不是我在布局中说的 180 像素。

有xml:

0 投票
1 回答
3531 浏览

android - ANDROID: How to fix the position of a ImageButton relative to the background?

How to fix the position/layout of a ImageButton/Button/ImageView relative to the background?

I'd tried something like this:

When I change the display resolution, the background_img stretch to cover the new area, but the ImageButton doesn't streetch and doesn't respect the bottom margin proportionately.

0 投票
3 回答
2126 浏览

android - 在 Android 中动态加载布局

我的应用程序需要 2 个屏幕,为此我XML使用RelativeLayout. 每当我运行我的活动时,都会加载一个布局文件。现在我想将第二个布局加载到相同的Activity位置,当用户单击一个按钮时,OptionsMenu以及当用户按下后退按钮时,第一个屏幕加载而不是退出应用程序。这样我就不需要Intent在我的应用程序中创建另一个。

0 投票
2 回答
7614 浏览

android - 在 2.2 中的 RelativeLayout 中重叠 TextView 项;1.6没问题

我有一个RelativeLayout包含两个TextViews 和 a的问题ImageView,我用它来显示 a 中的项目ListView。这些项目在 Android 1.6 上正确显示,但在 Android 2.2 上TextViews 重叠。

这是一张并排显示正确和错误行为的图像:

替代文字

这是我的RelativeLayout的源代码:

知道我做错了什么吗?

非常感谢,

菲利普

0 投票
1 回答
1675 浏览

java - 如何在 RadioButton 中放置 EditText 和 TextView?

我在RelativeLayout 中有一个RadioGroup。我有几个 RadioButtons 用于不同的选项,例如“Bob”、“Joe”和“Fred”。但是,我需要在 RadioButton 旁边添加一个带有 EditText 的“Other...”选项,以防用户想要输入“Steve”。有没有办法做到这一点?

0 投票
2 回答
4913 浏览

android - 如何轻松地将我的 LinearLayouts 转换为 RelativeLayouts

我有 4 个LinearLayout我想转换成RelativeLayouts。使用我的xml这里,我有,作为我的首选格式:

  • 图像按钮
  • 图像按钮
  • 文本视图
  • 按钮

如何更改为RelativeLayout始终ImageButton在最顶部显示第一个,始终Button在最底部显示第一个,第二个在ImageButton第一个下方,第二个和常规之间?ImageButtonTextViewImageButtonButton

谢谢!

0 投票
1 回答
1465 浏览

android - 在 RelativeLayout 中将 ImageButton 和 TextView 居中

android:layout_gravity="center"在 a 中的工作似乎与在 aRelativeLayout中的工作不同LinearLayout

我希望 aImageButton和 a都以 aTextView为中心RelativeLayout- 是否有基本xml代码?