HI , why my text is not coming at the bottom evethough i have given tParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); Here is my code please help,
footScroll_relative = new RelativeLayout(this);
footScroll_scrollView = new ScrollView(this);
footScroll_horizontalScrollView = new HorizontalScrollView(this);
test_text = new TextView(this);
footScroll_relative.setLayoutParams(new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT,android.view.ViewGroup.LayoutParams.FILL_PARENT));
LayoutParams tParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);开发者_StackOverflow中文版
tParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
footScroll_horizontalScrollView.setLayoutParams(new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT,android.view.ViewGroup.LayoutParams.FILL_PARENT));
footScroll_scrollView.setLayoutParams(tParams);
test_text.setText("Ramesh ");
footScroll_horizontalScrollView.addView(test_text);
footScroll_scrollView.addView(footScroll_horizontalScrollView);
footScroll_relative.addView(footScroll_scrollView);
setContentView(footScroll_relative);
this is an example of how to
TextView tView = ((TextView)view.findViewById(R.id.seekBarFilterLabel));
LayoutParams tParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
tParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
tView.setLayoutParams(tParams);
Hope this helps
EDIT: well, in your previuos unedited question you ask how to align the text at a RelativaLayout parent bottom, but here you are adding the TextView inside a HorizontalScrollView, wich is incorrect, the rule RelativeLayout.ALIGN_PARENT_BOTTOM are only valid if you are adding a view inside a RelativeLayout, not inside of ScrollView.
精彩评论