Scrolling?
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.
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] wrote:
you can add a ScrollView
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/baoyongzhang/android-ActionSheet/issues/20#issuecomment-243391470, or mute the thread https://github.com/notifications/unsubscribe-auth/AM-JvXBlmqyTpcMEjQYmStxm9bdJUBQXks5qk_52gaJpZM4HIVzk .
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] wrote:
i just create new class ActionSheet.java..and copy all the code from the library and replace it with this code.. :)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/baoyongzhang/android-ActionSheet/issues/20#issuecomment-246413047, or mute the thread https://github.com/notifications/unsubscribe-auth/AM-JvSRnOqp3BeK5toqZxJUHk2_9gDCVks5qpYOsgaJpZM4HIVzk .
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:
Oh sorry, i got u wrong. First i have to create a new class and use the above code that you gave. Is it?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/baoyongzhang/android-ActionSheet/issues/20#issuecomment-246418504, or mute the thread https://github.com/notifications/unsubscribe-auth/AIocsBlkrfDMOAcPeQ-XDs-B1Ws_8SJpks5qpYePgaJpZM4HIVzk .