Android Gallery 在两个视图之间启动
我有一个带有画廊的 Android 应用程序,可以在文本切换器视图之间切换。它总是在两个文本切换器视图之间开始。为什么会出现这种情况?我将选择设置为特定位置。
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); g = (画廊) findViewById(R.id.画廊); g.setAnimationDuration(200); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
g.setAdapter(hello);
g.setSpacing(20);
g.setSelection(2);
I have an android application with a gallery that switches between textswitcher views. It always starts in between two textswitcher views. Why does this happen? I'm setting the selection to a specific position.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
g = (Gallery) findViewById(R.id.gallery);
g.setAnimationDuration(200);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
g.setAdapter(hello);
g.setSpacing(20);
g.setSelection(2);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然这是一个老问题,但我也遇到了同样的问题,也许它对其他人有帮助。这是我的适配器的关键部分:
我想同时显示三个项目,所以我采用了
parent.getWidth()/3
。然而,这导致画廊在两种观点之间开始。获取上面代码示例中显示的显示宽度对我来说效果很好Although this is an old question, I had the same problem and maybe it helps others. This was the crucial part of my Adapter:
I wanted to have three items shown at the same time, so I took
parent.getWidth()/3
. however this led the gallery to start between two views. Getting the displays width shown in the upper code-sample worked fine for me