1 Şubat 2018 Perşembe

ScrollView Sınıfı

Giriş
Şöyle tanımlarız.
<ScrollView ...>

 <LinearLayout ...">
  <EditText .../>
  <CheckBox .../>
  <CheckBox .../>
  <TextView .../>
  <Button .../>
   ...
 </LinearLayout>

</ScrollView>
fullScroll metodu
Şöyle yaparız.
scrollView.post(new Runnable() {
    @Override
    public void run() {
        scrollView.fullScroll(ScrollView.FOCUS_DOWN);
    }
});
scrollTo metodu
Şöyle yaparız.
scrollView.post(new Runnable() {
    @Override

    public void run() {

        scroll.scrollTo(0, scroll.getBottom());

    }
});
setBackground metodu
XML ile şöyle yaparız.
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scroll_formatted"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="false"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:background="@color/Your_White_Color">
Şöyle yaparız.
ScrollView scrollView = (ScrollView) findViewById(R.id.scroll_formatted);
scrollView.setBackground(R.color.Your_White_Color);

Hiç yorum yok:

Yorum Gönder