我可以改变一个viewpager内部的视图的宽度是多少? [英] Can I change the width of a view inside a viewpager?

查看:115
本文介绍了我可以改变一个viewpager内部的视图的宽度是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用的是Viewpager 3个片段。我想知道如果我可以改变的第一个片段的宽度。

I'm currently using a Viewpager with 3 fragment. I would like to know if I can change the width of the first fragment.

其实,我试试这个做像在Android Play商店的类别菜单,当你用平板电脑看它,它看起来像一个片段,但滑动到它的时候,所以你仍然可以看到该片段它不是把所有的空间旁边(我不知道我是不是清楚)。我在想,如果我能根本,通过改变从MATCH_PARENT第一个片段的宽度为一个固定值,我甚至不知道,如果这样做的结果可能是很好的。

In fact , I try this do to something like the category menu in the android play store when you watching it with tablet, it looks like a fragment but its not taking all the space when swiping to it so you still see the fragment next to it (i don't know if i'm clear). I was wondering if I could simply do that by changing the width of the first fragment from MATCH_PARENT to a fixed value, i don't even know if the result of this could be nice.

我试过setLayoutParams(),将其设置在XML中,似乎没有任何工作。片段仍然匹配父。

i tried setLayoutParams() , set it in the xml , nothing seems to work. the fragment still match parent.

推荐答案

通过ViewPager,它不支持。你必须写自己的ViewGroup类,或者你可以尝试的东西,因为我在<一个回答href=\"http://stackoverflow.com/questions/10569208/swipe-half-page-in-a-viewpager-from-compatibility-pack/10575613#10575613\">this问题。

With ViewPager, it is not supported. You have to write your own ViewGroup class, or you might try something as i answered in this question.

这篇关于我可以改变一个viewpager内部的视图的宽度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆