就像标题所示,我有一个 ScrollView 直到我将设备从纵向切换到横向或从横向切换到纵向以触发onConfigurationChanged()
我的 Activity 事件时才会滚动。
我已经在我的 Nexus S (2.3.3) 和 Emulator (4.0.3) 上尝试了 Activity,它显示了同样奇怪的行为。
我也尝试过将布局应用于 Activity 时,仍然没有运气。
我的 Activity 的 XML 布局可以在这里找到(它有点长,我不想用 XML 把我的问题搞得一团糟)。
为了帮助我,这里有一些可能与你们相关的代码:
/** {@inheritDoc} */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.terms_and_agreements);
//fire up the AsyncTask to get data
showLoadingProgress();
mBookingInfoTask = new BookingInfoTask();
mBookingInfoTask.execute();
}
/** {@inheritDoc} */
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
/** This methode is called when the BookingInfoTask has finished collecting date from the server */
public void onBookingInfoResult(String clubTerms, String portalTerms) {
final String fClubTerms = clubTerms;
final String fPortalTerms = portalTerms;
runOnUiThread(new Runnable() {
public void run() {
TextView tvTerms = (TextView) findViewById(R.id.tvTerms);
tvTerms.setText(fClubTerms + "\n\n" + fPortalTerms);
}
});
hideProgress(); //Hides progress bar
}
最后是我的活动清单声明:
<activity
android:name=".ConfirmationActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar" />