Web-View-Inhalte flackern in Android?
Ich benutzediese lib für horizontales Streichen. Überprüfen Sie den folgenden Code
Die Wischfunktion funktioniert einwandfrei, aber wenn ich direkt zur Folie gehe, werden keine Inhalte in der Webansicht angezeigt. Gezeigt einige unten Bild für mehr Details: -
Nach dem obigen Bild funktioniert es immer, wenn ich wische, aber wenn wir direkt zur nächsten Folie gehen wollen, dann verschwinden die Inhalte wie unten gezeigt:
und dann zeigt es unten
Code
PageControl mPageControl = (PageControl) findViewById(R.id.page_control);
mSwipeView = (SwipeView) findViewById(R.id.swipe_view);
mSwipeView.setPageControl(mPageControl);
for (int i = 0; i < 10; i++) {
mSwipeView.addView(new FrameLayout(this));
}
for (int i = 0; i < 10; i++) {
((FrameLayout) mSwipeView.getChildContainer().getChildAt(i))
.addView(setupView());
count++;
}
setupView ()
public View setupView() {
LayoutInflater layoutInflator = getLayoutInflater();
LinearLayout childlayout = (LinearLayout) layoutInflator.inflate(
R.layout.webview, Switcher, false);
// adding all the things in which define in below XML
return childlayout;
}
xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/main_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/layClick"
android:layout_width="43dp"
android:layout_height="64dp"
android:background="@drawable/queslay"
android:gravity="left"
android:orientation="vertical" >
// some stuff
</LinearLayout>
<LinearLayout
android:id="@+id/main_question"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<WebView
android:id="@+id/ques"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/option_main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/solution_confirm"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@null"
android:gravity="center"
android:orientation="horizontal" >
// some stuff
</LinearLayout>
auch xml aufblasen"@ + id / option_main" mit unter xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- <FL><LL><FL></FL><BTN/></LL></FL> -->
<RelativeLayout
android:id="@+id/option_relative_a"
android:layout_width="fill_parent"
android:layout_margin="10dp"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/option_a"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="40dp"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/btn_a"
android:layout_width="47dp"
android:layout_height="19dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/opgrey"
android:gravity="center"
android:text="@string/a"
android:textColor="#ffffff"
android:textSize="12sp" />
<ImageView
android:id="@+id/ch_a"
android:layout_width="21dp"
android:layout_height="18dp"
android:layout_marginTop="5dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/cross"
android:gravity="center"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:orientation="vertical" >
<WebView
android:id="@+id/ques_option_a"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/option_image_a"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignBottom="@+id/option_a"
android:background="@null" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/option_relative_b"
android:layout_width="fill_parent"
android:layout_margin="10dp"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/option_b"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="40dp"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/btn_b"
android:layout_width="47dp"
android:layout_height="19dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/opgrey"
android:gravity="center"
android:text="@string/b"
android:textColor="#ffffff"
android:textSize="12sp" />
<ImageView
android:id="@+id/ch_b"
android:layout_width="21dp"
android:layout_height="18dp"
android:layout_marginTop="5dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/cross"
android:gravity="center"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:orientation="vertical" >
<WebView
android:id="@+id/ques_option_b"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/option_image_b"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignBottom="@+id/option_b"
android:background="@null" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/option_relative_c"
android:layout_width="fill_parent"
android:layout_margin="10dp"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/option_c"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="40dp"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/btn_c"
android:layout_width="47dp"
android:layout_height="19dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/opgrey"
android:gravity="center"
android:text="@string/c"
android:textColor="#ffffff"
android:textSize="12sp" />
<ImageView
android:id="@+id/ch_c"
android:layout_width="21dp"
android:layout_marginTop="5dp"
android:layout_height="18dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/cross"
android:gravity="center"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:orientation="vertical" >
<WebView
android:id="@+id/ques_option_c"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/option_image_c"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignBottom="@+id/option_c"
android:background="@null" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/option_relative_d"
android:layout_width="fill_parent"
android:layout_margin="10dp"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/option_d"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="40dp"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/btn_d"
android:layout_width="47dp"
android:layout_height="19dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/opgrey"
android:gravity="center"
android:text="@string/d"
android:textColor="#ffffff"
android:textSize="12sp" />
<ImageView
android:id="@+id/ch_d"
android:layout_width="21dp"
android:layout_height="18dp"
android:layout_marginTop="5dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/greentick"
android:gravity="center"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:orientation="vertical" >
<WebView
android:id="@+id/ques_option_d"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/option_image_d"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/option_d"
android:background="@null" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/option_relative_e"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/option_e"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="40dp"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/btn_e"
android:layout_width="47dp"
android:layout_height="19dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/opgrey"
android:gravity="center"
android:text="@string/e"
android:textColor="#ffffff"
android:textSize="12sp" />
<ImageView
android:id="@+id/ch_e"
android:layout_width="21dp"
android:layout_height="18dp"
android:layout_marginTop="5dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/greentick"
android:gravity="center"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:orientation="vertical" >
<WebView
android:id="@+id/ques_option_e"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/option_image_e"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignBottom="@+id/option_e"
android:background="@null" />
</RelativeLayout>
Wischen funktioniert einwandfrei, es treten jedoch Probleme auf, wenn eine Folie direkt auf eine andere verschoben wird.
Helfen Sie mir, wenn Sie in der Vergangenheit vor ähnlichen Problemen gestanden haben.