smooth-scrolling


Listview SmoothScrollToPosition control with buttons and change item background


I wanna be control listview with buttons, up and down.
When I touch any button listview scrolling up or down.
By the way I wanna see whic one item I catch. Same to TVLİST.
I add photo and easy code.
How can I make this?enter image description here
package com.example.erdogan.seridro;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
ListView liste;
private TextView tx,tx2;
int x=0;
int y=0;
Button up,down;
private String [] ulkeler= {"Sayılar","1","2","3","4","5","6","7", "8", "9", "10","11",
"12", "13","12","11","10","9","8","7","6","5","4","3","2","1"};
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tx = (TextView) findViewById(R.id.textView);
up =(Button)findViewById(R.id.button4);
down =(Button)findViewById(R.id.button3);
liste=(ListView)findViewById(R.id.liste);
ArrayAdapter<String>adaptor= new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,android.R.id.text1,ulkeler);
liste.setAdapter(adaptor);
up.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
liste.smoothScrollToPosition(y);
y=y+1;
liste.getChildAt(4).setBackgroundColor(getResources().getColor(R.color.DarkOrange));
liste.getChildAt(5).setBackgroundColor(getResources().getColor(R.color.FloralWhite));
liste.getChildAt(6).setBackgroundColor(getResources().getColor(R.color.DarkOrange));
if (y>=25){y=24;}
}
});
down.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
y=y-1;
liste.smoothScrollToPosition(y);
liste.getChildAt(4).setBackgroundColor(getResources().getColor(R.color.DarkOrange));
liste.getChildAt(5).setBackgroundColor(getResources().getColor(R.color.FloralWhite));
liste.getChildAt(6).setBackgroundColor(getResources().getColor(R.color.DarkOrange));
if (y<1){y=1;}
}
});
}}
https://i.stack.imgur.com/MsgsJ.jpg

Related Links

Smooth scroll function really slow
Instagram snapwidget stops the smoothscroll
Listview SmoothScrollToPosition control with buttons and change item background
So smooth scrolling like on this website
One Page Scroll add Active class depending on scroll position
Smooth-Div-Scroll and iPad

Categories

HOME
netty
jenkins-pipeline
snappy
sms
opengl-es
download
thermal-printer
aggregate-functions
subprocess
segmentation-fault
select2
aspectj
virtualenv
watson-dialog
cakephp-2.0
jsfiddle
loss
k-means
orange
react-jsx
git-branch
typedef
fibonacci
connectiq
jira-zephyr
azure-table-storage
dynamics-ax-2012-r3
spring-data-gemfire
foxpro
n1ql
aweber
leaderboard
kofax
mixed-models
binary-decision-diagram
wufoo
smooth-streaming
f#-fake
scrapinghub
jks
denodo
openxava
extjs3
dmalloc
cedar-bdd
firebase-job-dispatcher
jspx
scriptengine
syslog4j
weblogic-maven-plugin
dcast
containstable
fadein
nslocalizedstring
cascading
dynamics-nav-2013
wiql
transbase
persian
page-flipping
uinavigationitem
jsoncpp
hexagonal-tiles
p4python
eula
photogrammetry
data-representation
teamwork
firebase-tools
illegalargumentexception
api-eveonline
parsefloat
selenium-grid2
scjp
mvcgrid
debuggervisualizer
db2-connect
netbeans-plugins
friendly-id
android-library
outlook-object-model
vline
qt5.1
libx264
tasklist
linear-interpolation
towerjs
joomla1.7
visual-leak-detector
code-organization
mscorlib
jqtransform
noise-reduction
dongle
linq-to-mysql
webdb
versions
web-widget
file-storage
html-help-workshop
jettison
software-update
cons

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App