I can’t resolve my problem with scrollView and webView,
I know, that i can’t put webview into scrollview but I have’t idea how to jump it.
In my scrollView, I have image ( 1280 x 1300 > ) and this image must be scrolling, under image i must have webview with html content. have you any idea how should I do that?
is any another way to put html content with to some view?
this is my xml view, and I add image and webview in my activity class
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mainLinear"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ScrollView
android:id="@+id/scroll_journal_page"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ScrollView>
<Gallery
android:id="@+id/listview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#d5d5d3" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
i create view somethink like that:
protected void onPostExecute(Bitmap result) {
Animation fadeInAnimation = AnimationUtils.loadAnimation(Journal.this, R.anim.fade_in);
relativeLayout = new LinearLayout(getApplicationContext());
relativeLayout.setLayoutParams(new FrameLayout.LayoutParams(WIDTH, result.getHeight() + HEIGHT));
relativeLayout.setOrientation(1);
coverImage = new ImageView(getApplicationContext());
coverImage.setImageBitmap(result);
relativeLayout.addView(coverImage);
Integer pageNumber = Integer.valueOf(ArrayHelper.journalList.get(pageIdentity).get("pageId").toString());
File file = new File(Environment.getExternalStorageDirectory() + "/MCW/"+ pageNumber +"/content.html");
if(file.exists()) {
LinearLayout linearLayout = new LinearLayout(getApplicationContext());
linearLayout.setLayoutParams(new FrameLayout.LayoutParams(WIDTH, HEIGHT));
WebView wV = new WebView(getApplicationContext());
try {
InputStream fin = null;
int len;
fin = new BufferedInputStream(new FileInputStream(file));
byte[] buffer = new byte[fin.available()];
len = fin.read(buffer);
fin.close();
String rawText = EncodingUtils.getString(buffer, 0, len, "utf-8");
wV.loadDataWithBaseURL("", rawText, "text/html", "utf-8", null);
}catch (Exception e) {}
linearLayout.addView(wV);
relativeLayout.addView(linearLayout);
}
scrollview.addView(relativeLayout);
scrollview.setAnimation(fadeInAnimation);
isReadyToChange = true;
}
Just use a Scrollview with Height FillParent
add a linearlayout height= deviceHeight+imageHeight
use a linearlayout with height of device
add webview to this linearlayout
add image and linearlayout to this layout