How do you eliminate the white border while you're halfway through the next view?

iam with Aphid-FlipView-Library to display static html pages using webview.

but when flipping (moving) from one page to another iam gets some white frame after which the second page usually loads.

Can anyone help me how to remove this flash appearance.

public class FlipTextViewFragment extends Fragment {
private FlipViewController flipView;
String[] urls = {"file:///android_asset/Introduction_print.html","file:///android_asset/introduction2.html"};

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    flipView = new FlipViewController(inflater.getContext(), FlipViewController.HORIZONTAL);
    flipView.setAdapter(new adp(getActivity().getApplicationContext()));
    return flipView;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
}
public void setText(String item) {
    flipView.setAdapter(new adp(getActivity().getApplicationContext()));
    }}

      

then my adapter class is here: com.example.flipwebview package;

 public class adp extends BaseAdapter {
 String[] urls = {"file:///android_asset/Introduction_print.html","file///android_asset/introduction2.html"};
   Context con; 
public adp(Context applicationContext) {
    // TODO Auto-generated constructor stub
    con=applicationContext;
}
    @Override
public int getCount() {
    // TODO Auto-generated method stub
    return urls.length;
}
   @Override
public Object getItem(int position) {
    // TODO Auto-generated method stub
    return position; 
}
   @Override 
public long getItemId(int position) {
    // TODO Auto-generated method stub
    return position;
}
    @Override
public View getView(final int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    WebView wv=new WebView(con);
    wv.loadUrl(urls[position]);
return wv; 
}} 

      

Using my code, I can flip multiple webviews, but the problem I get is when I am halfway to a page where I cannot see my next view, it seems to be a blank page, it loads after i will flip my page completely ... no screen relative to this

enter image description here

+3


source to share


1 answer


loadUrl

is not the fastest way to render local HTML files. Since they are included in your application, you must load their content into String

and use the method loadData

.

http://developer.android.com/reference/android/webkit/WebView.html#loadData%28java.lang.String,%20java.lang.String,%20java.lang.String%29



EDIT:
One more thing. You should use convertView instead of creating a new WebView every time you flip.

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    WebView webView = null;
    if (convertView == null)
    {
       webView = new WebView(con);
    } else {
       webView = (WebView) convertView;
    }

    webView.loadUrl(urls[position]);
    return webView; 
}} 

      

0


source







All Articles