Android 在调用onConfigurationChaged()之前,ScrollView一直处于停滞状态
正如标题所示,我有一个ScrollView,在我将设备从纵向切换到横向或从横向切换到纵向以触发我的活动的Android 在调用onConfigurationChaged()之前,ScrollView一直处于停滞状态,android,android-widget,android-scrollview,Android,Android Widget,Android Scrollview,正如标题所示,我有一个ScrollView,在我将设备从纵向切换到横向或从横向切换到纵向以触发我的活动的OnConfiguration Changed()事件之前,它不会滚动 我在NexusS(2.3.3)和Emulator(4.0.3)上尝试了这个活动,它显示了相同的奇怪行为 我也尝试过在活动中应用布局时玩转,但仍然没有运气 可以找到我的活动XML布局(它有点长,我不想用XML把我的问题弄得一团糟) 下面是一些代码,你们可以看看这些代码来帮助我: /** {@inheritDoc} */ @O
OnConfiguration Changed()
事件之前,它不会滚动
我在NexusS(2.3.3)和Emulator(4.0.3)上尝试了这个活动,它显示了相同的奇怪行为
我也尝试过在活动中应用布局时玩转,但仍然没有运气
可以找到我的活动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" />
我通过将文本视图(应该填充父视图)包装成线性布局来实现它,如下所示:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<TextView
android:id="@+id/tvTerms"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:paddingBottom="6dip"
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:textColor="#000000" />
</LinearLayout>
下面是当我无法让它滚动时的情况:
<TextView
android:id="@+id/tvTerms"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1.0"
android:paddingBottom="6dip"
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:textColor="#000000" />
现在它像应该的那样滚动