为多个屏幕创建我的视图 android

发布于 2024-12-10 01:43:42 字数 224 浏览 3 评论 0原文

我在不同的屏幕尺寸上显示视图时遇到问题。 在此处输入图像描述

我附加的视图在 3.2 英寸屏幕中不完全可见,但在 3.7 英寸屏幕中正常。我已经在图像本身中描述了 sml 内容。请提出一个解决方案。

通常,对于多个屏幕来说,理想的处理方式是什么? android 是否可以根据不同的屏幕尺寸自动调整它?

I have a problem to display my view on different screen size. enter image description here

My attached view is not fully visible in 3.2 inch screen but ok with 3.7 inch screen. I have described the sml contents in the image itself. Please suggest a solution.

Normally what is ideal way of doing things for multiple screens? Does android have adusting it automatically for different screen sizes?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

东风软 2024-12-17 01:43:42

设置你的 LinearLayout 高度 fillparent :

android:layout_height="fill_parent"

当然你的滚动视图必须有一个相对高度。

但是......

我会这样做的方式是下一个:

相对布局
-滚动视图
-LinearLayout(带按钮)

然后首先在你的xml中放入你的 LinearLayout ,宽度固定高度,然后在scrollView中创建 android:layout_below="@+id/LinearLayoutId" 。之后把
android:layout_height="fill_parent" 在scrollView中,完成放置LinearLayout android:layout_alignParentBottom="true"

make your linearLayout height fillparent :

android:layout_height="fill_parent"

and of course your scrollview must have a relative height .

But...

The way i would do that , is the next:

RelativeLayout
-scrollview
-LinearLayout (with button)

Then put first in your xml your linearLayout , width an fixed height , then make the android:layout_below="@+id/LinearLayoutId" in the scrollView . After that put the
android:layout_height="fill_parent" in the scrollView , finalizing putting the LinearLayout android:layout_alignParentBottom="true"

牵你的手,一向走下去 2024-12-17 01:43:42

一种好的方法是使用layout_weight告诉Android布局的哪些部分应该拉伸以适应屏幕的比例。您还应该使用将layout_width、layout_height 设置为fill_parent 来调整主LinearLayout 的大小以适合屏幕。

One good approach is to use layout_weight to tell Android which parts of the layout should be stretched to fit the screen in what proportions. You should also use layout_width, layout_height set to fill_parent to size your main LinearLayout to fit the screen.

与之呼应 2024-12-17 01:43:42

您可以

在主 LinearLayout 中使用 weightSum

和在子布局中使用 layout_weight 两件事。

这对你有用。

You can use 2 things

weightSum in the Main LinearLayout

and layout_weight in the child Layouts.

That Will Work for You.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文