Vertical Scroll bar with Horizontal Scroll Android -
running "unable scroll" issues
- i trying customized vertical scrollbar working ability scroll horizontally.
- i trying put 7 vertical scrollbars (@+id/verticalseekbar, @+id/verticalseekbar_2 etc.) in horizontal scrollbar.
- i (with of stackoverflow) able custom vertical scrollbar.
however, unable scroll through horizontally. want able scroll horizontally doesn't work. attached image of how want be. here code activity_vertical_slider
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <com.example.verticalsliderandroid.hscroll android:id="@+id/hscroll" android:layout_width="400dp" android:layout_height="wrap_content"> <relativelayout android:id="@+id/relative_layout_sample" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <com.example.verticalsliderandroid.verticalseekbar android:id="@+id/verticalseekbar" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignparentleft="true" android:layout_centervertical="true" android:max="255" android:progress="10" android:rotation="180" android:progressdrawable="@android:color/transparent" android:thumb="@drawable/eco_seekbar" /> <com.example.verticalsliderandroid.verticalseekbar android:id="@+id/verticalseekbar_2" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignparenttop="true" android:layout_torightof="@+id/verticalseekbar" android:max="255" android:progress="10" android:progressdrawable="@android:color/transparent" android:rotation="180" android:thumb="@drawable/eco_seekbar" /> </relativelayout> </com.example.verticalsliderandroid.hscroll> </relativelayout>
here verticalseekbar.java
public class verticalseekbar extends seekbar { public verticalseekbar(context context) { super(context); } public verticalseekbar(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); } public verticalseekbar(context context, attributeset attrs) { super(context, attrs); } protected void onsizechanged(int w, int h, int oldw, int oldh) { super.onsizechanged(h, w, oldh, oldw); } @override protected synchronized void onmeasure(int widthmeasurespec, int heightmeasurespec) { super.onmeasure(heightmeasurespec, widthmeasurespec); setmeasureddimension(getmeasuredheight(), getmeasuredwidth()); } protected void ondraw(canvas c) { c.rotate(-90); c.translate(-getheight(), 0); super.ondraw(c); } @override public boolean ontouchevent(motionevent event) { if (!isenabled()) { return false; } switch (event.getaction()) { case motionevent.action_down: case motionevent.action_move: case motionevent.action_up: setprogress(getmax() - (int) (getmax() * event.gety() / getheight())); onsizechanged(getwidth(), getheight(), 0, 0); break; case motionevent.action_cancel: break; } return true; } }
i have searched enough on internet. not getting need. please help.
case motionevent.action_down: case motionevent.action_move: case motionevent.action_up:
dont u need break after action_down , action_move ? if dont have break
s, , move actions turn up, , never able test scroll bar movement.
edit : try so question
Comments
Post a Comment