English 中文(简体)
我可以改变页面查看器内视图的宽度吗?
原标题:Can I change the width of a view inside a viewpager?

目前我正在使用一个带有3个碎片的视图页面。 我想知道我是否能改变第一个碎片的宽度。

事实上,我尝试这样对类菜单 在机器人游戏店里, 当你用平板电脑看它的时候, 它看起来像一个碎片, 但是它没有占用所有空间去擦它, 这样你仍然能看到它旁边的碎片( 我不知道我是否清楚)。 我在想我能不能简单地通过把第一块碎片的宽度从Match_Parent 改变为固定值来做到这一点, 我甚至不知道它的结果会不会很好。

我尝试了设置LayoutParams (), 将其设置在 xml 中, 似乎没有效果 。 碎片仍然匹配母体 。

最佳回答

使用 ViewPager, 它不被支持 。 您必须写入您自己的 View Group 类, 或者您可以尝试一些我在 < a href=> https:// stackoverflow. com/ questionss/ 10569208/ swipe- half- page- in- a- viewpager- from- compartible- packpack/ 105575613# 105755613" 中回答的问题

问题回答

实际上,您可能想要尝试在 ViewPager 页面上设置负差, 使用 < a href="http:// developmenter.android.com/ reference/android/support/v4/view/ViewPager.html#setPagePgin%28int%29" rel="Nofollown noreferrr"\\\ code> setPageMargin(int) 。 另见我不久前就类似问题提供的这个答案 :





相关问题
Very basic WPF layout question

How do I get this listbox to be maxiumum size, i.e. fill the group box its in. I ve tried width="auto" Height="auto", width="stretch" Height="stretch" annoyingly at the moment, it dynamicly sizes to ...

How to align the text to top of TextView?

How to align the text to top of a TextView? Equivalent Android API for Swings setInsets()? that is top of text should start be in (0,0) of TextView <?xml version="1.0" encoding="utf-8"?> <...

Centring a flow in Shoes

Can I center the contents of a flow in Shoes? I know that a paragraph can be centred like: para Centred paragrpah , :align=> center However, this does not work with flows: flow(:align=> ...

Overlaying with CSS

I want to load a website in an iframe, and overlay the website with some hints about the website that is shown. However, i got stuck at the point that the website has a variable passive white space at ...

How do you normally make a program look beautiful? [closed]

How can I make an Application look nice and not like an amateur pulled it together? I mean graphic-wise. Is there some sort of book you can read regarding beautiful program layouts, etc? I put this ...

热门标签