[英]2 seekbars on eachother (android)
In my application I have 2 seekbars. 在我的应用程序中,我有2个搜索栏。 The error is that they are on each other!
错误是它们彼此靠在一起! I just cant put them 2 next to each other across all the width of the screen!
我只是不能将它们2在屏幕的整个宽度上彼此相邻! They are alignd to the left!
它们向左对齐! I want one aligned to th left, one to the right!
我想要一个左对齐,一个右对齐!
The code is: 代码是:
public View wrapLabelAndSeekbar(String labelText, int width)
{
RelativeLayout layout = new RelativeLayout(this);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(250, 250);
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); // Doesn't work
seekerWidth = new SeekBar(this);
seekerHeight = new SeekBar(this);
seekerWidth.setProgress(Main.seekerPlaceWidth);
seekerHeight.setProgress(Main.seekerPlacHeight);
layout.addView(seekerHeight, params);
layout.addView(seekerWidth, params);
return layout;
}
I can only change their size up to half the screen. 我最多只能将其大小更改为屏幕的一半。 No more.
不再。
What can I do? 我能做什么?
与往常一样,这是一个小错误...显然...我只是将屏幕的宽度一分为二,所以所有屏幕都位于同一位置...
RelativeLayout ll = new RelativeLayout(this);
ll.setId(99);
seekerWidth = new SeekBar(this);
seekerHeight = new SeekBar(this);
seekerWidth.setProgress(Main.seekerPlaceWidth);
seekerHeight.setProgress(Main.seekerPlacHeight);
seekerWidth.setId(1);
seekerHeight.setId(2);
RelativeLayout.LayoutParams lay = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
lay.addRule(RelativeLayout.ALIGN_PARENT_TOP);
ll.addView(seekerWidth, lay);
RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
p.addRule(RelativeLayout.BELOW, seekerWidth.getId());
ll.addView(seekerHeight, p);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.