-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scrolling Problem #27
Comments
OK i solved it by change your code a little bit.. i add a scrollview and the cancel button stay at the bottom.. can you take a look at this code.. and add to your library, so everyone can use it. TQ private void createItems() {
String[] titles = getOtherButtonTitles();
RelativeLayout relativeLayout = new RelativeLayout(getActivity());
RelativeLayout.LayoutParams rll = new RelativeLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
relativeLayout.setLayoutParams(rll);
ScrollView scrollView = new ScrollView(getActivity());
RelativeLayout.LayoutParams ll = new RelativeLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
ll.addRule(RelativeLayout.ABOVE,ActionSheet.CANCEL_BUTTON_ID);
ll.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
scrollView.setLayoutParams(ll);
scrollView.setPadding(0,0,0,200);
LinearLayout linearLayout = new LinearLayout(getActivity());
LinearLayout.LayoutParams ll2 = new LinearLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
linearLayout.setOrientation(LinearLayout.VERTICAL);
linearLayout.setLayoutParams(ll2);
if (titles != null) {
for (int i = 0; i < titles.length; i++) {
Button bt = new Button(getActivity());
bt.setId(CANCEL_BUTTON_ID + i + 1);
bt.setOnClickListener(this);
bt.setBackgroundDrawable(getOtherButtonBg(titles, i));
bt.setText(titles[i]);
bt.setTextColor(mAttrs.otherButtonTextColor);
bt.setTextSize(TypedValue.COMPLEX_UNIT_PX, mAttrs.actionSheetTextSize);
if (i > 0) {
LinearLayout.LayoutParams params = createButtonLayoutParams();
params.topMargin = mAttrs.otherButtonSpacing;
linearLayout.addView(bt, params);
} else {
linearLayout.addView(bt);
}
}
}
scrollView.addView(linearLayout);
relativeLayout.addView(scrollView);
Button bt = new Button(getActivity());
bt.getPaint().setFakeBoldText(true);
bt.setTextSize(TypedValue.COMPLEX_UNIT_PX, mAttrs.actionSheetTextSize);
bt.setId(ActionSheet.CANCEL_BUTTON_ID);
bt.setBackgroundDrawable(mAttrs.cancelButtonBackground);
bt.setText(getCancelButtonTitle());
bt.setTextColor(mAttrs.cancelButtonTextColor);
bt.setOnClickListener(this);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
params.topMargin = mAttrs.cancelButtonMarginTop;
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
bt.setLayoutParams(params);
relativeLayout.addView(bt);
mPanel.addView(relativeLayout);
mPanel.setBackgroundDrawable(mAttrs.background);
mPanel.setPadding(mAttrs.padding, mAttrs.padding, mAttrs.padding, mAttrs.padding);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to make it scroll if the list is long..? please help..
The text was updated successfully, but these errors were encountered: