为多个屏幕创建我的视图 android
我在不同的屏幕尺寸上显示视图时遇到问题。
我附加的视图在 3.2 英寸屏幕中不完全可见,但在 3.7 英寸屏幕中正常。我已经在图像本身中描述了 sml 内容。请提出一个解决方案。
通常,对于多个屏幕来说,理想的处理方式是什么? android 是否可以根据不同的屏幕尺寸自动调整它?
I have a problem to display my view on different screen size.
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
设置你的 LinearLayout 高度 fillparent :
当然你的滚动视图必须有一个相对高度。
但是......
我会这样做的方式是下一个:
然后首先在你的xml中放入你的 LinearLayout ,宽度固定高度,然后在scrollView中创建
android:layout_below="@+id/LinearLayoutId"
。之后把android:layout_height="fill_parent"
在scrollView中,完成放置LinearLayoutandroid:layout_alignParentBottom="true"
make your
linearLayout
heightfillparent
:and of course your scrollview must have a relative height .
But...
The way i would do that , is the next:
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 theandroid:layout_height="fill_parent"
in the scrollView , finalizing putting the LinearLayoutandroid:layout_alignParentBottom="true"
一种好的方法是使用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.
您可以
在主 LinearLayout 中使用
weightSum
和在子布局中使用
layout_weight
两件事。这对你有用。
You can use 2 things
weightSum
in the Main LinearLayoutand
layout_weight
in the child Layouts.That Will Work for You.