나는 listview를 사용하는 활동을위한이 레이아웃 xml 파일을 가지고있다. 항상 목록보기의 맨 위에서 시작한다는 점만 제외하면 정상적으로 작동합니다. 레이아웃의 맨 위에있는 것이 아닙니다. 내가 테스트 한안드로이드에서 위로 스크롤 막대를 시작하는 방법?
listView.setSelection(0);
그것은 나를 위해 작동하지 않았다. 화면을 맨 위에서 어떻게 표시 할 수 있습니까?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/topLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/darkbackground"
>
<include layout="@layout/subtitle_bar" />
<TextView
android:id="@+id/rankHistory"
android:text="@string/rankHistory"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="20px"
android:textSize="24sp"
android:textStyle="bold"
android:textColor="#ffffffff"
android:gravity="center"
android:layout_gravity="center_horizontal"
></TextView>
<ListView android:id="@+id/list"
android:layout_marginTop="15px"
android:layout_width="fill_parent"
android:layout_height="500px"
android:dividerHeight="15px"
android:divider="@color/darkbackground"
>
</ListView>
</LinearLayout>
</ScrollView>
제안 해 주셔서 감사합니다. 하지만 작동하지 않았다 ... – Kou
시간을 좀주세요. 테스트 프로젝트를 만들고이를 수정하려고합니다. 그것은 나를 위해 역시 재미있다 :) – ihrupin
나는 해결책을 발견했다! !!! listView.smoothScrollToPosition (0); – ihrupin