我有main.java:
public class Main extends PreferenceActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.activity);
PreferenceScreen screen = this.getPreferenceScreen();
Preference preference;
preference = new Preference(screen.getContext());
preference.setSummary("Hi");
screen.addPreference(preference);
preference = new Preference(screen.getContext());
preference.setSummary("Hi");
screen.addPreference(preference);
preference = new Preference(screen.getContext());
preference.setSummary("Hi");
screen.addPreference(preference);
preference = new Preference(screen.getContext());
preference.setSummary("Hi");
screen.addPreference(preference);
preference = new Preference(screen.getContext());
preference.setSummary("My long text");
screen.addPreference(preference);
preference = new Preference(screen.getContext());
preference.setSummary("My long text");
screen.addPreference(preference);
}
我的activity.xml:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
</PreferenceScreen>
当我在列表顶部滚动时:
当我在列表底部滚动时:
ScrollBar在滚动期间发生变化。当我将所有首选项设置为相同的高度时,一切都很好。