سؤال

I have list of items and this list have Scroll bar , in windows scroll bar work nice but in android touch screen scroll bar be very tin and user cant touch scroll bar , I want users can scrolling list with touch on list only . TNX .

هل كانت مفيدة؟

المحلول

I find out.Must get touch screen pos and set a range for move .

scrollPosition1 = GUI.BeginScrollView(Rect (0,400,Screen.width,175),scrollPosition1,  Rect (0, 0, 650, 0)); 
        // touch screen 
        if (Input.touchCount==1 &&Screen.height -Input.GetTouch(0).position.y >  450 - scrollPositionHome.y && Screen.height - Input.GetTouch(0).position.y < 600 - scrollPositionHome.y )
        {
            var touchDelta2 : Vector2 = Input.GetTouch(0).deltaPosition;
            scrollPosition1.x +=touchDelta2.x;
        }
        GUI.skin.font = fnt;
        style.normal.textColor = Color.black;
        style.alignment = TextAnchor.MiddleRight;
        for (i=0;i < ImgSliderProducts.Length;i++)
        {
            GUI.DrawTexture(Rect(20+(i* 100),10,100,100), ImgSliderProducts[i],ScaleMode.ScaleToFit,true);
        }
GUI.EndScrollView(); 
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top