-
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? #20
Comments
Did you get any idea on scrolling the actionsheet? |
you can add a ScrollView |
have you added code or something that will help to add a scroll view? On Tue, Aug 30, 2016 at 3:42 PM, zhaodaizheng [email protected]
|
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);
} |
Thankyou very much #afiq for your help. |
i just create new class ActionSheet.java..and copy all the code from the library and replace it with this code.. :) |
Do i have to replace all the code from actionsheet java? On Mon, Sep 12, 2016 at 10:39 PM, Hafiq Iqmal [email protected]
|
Oh sorry, i got u wrong. First i have to create a new class and use the above code that you gave. Is it? |
Yup.. On 13 Sep 2016 01:10, "Rishav Chudal" [email protected] wrote:
|
In iOS, when we have too many items in the Action Sheet, more than can be displayed on screen, it automatically starts scrolling.
Is there any chance of scrolling being implemented in the action sheet? Please at least give suggestions on how this could be done, and I'll try to implement it.
The text was updated successfully, but these errors were encountered: