I have a WebView that I want to add my own back button to, The webview is one that has been set up specifically for viewing pdfs in app. I have added the button and it works but I am unable to resize it or move it around the screen, and as a result the pdf controls are underneath the button and unusable. The button layout parameters seem to be something along these lines (this is not in the code anywhere this is just what it appears to be )
<ImageButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
/>
Here is the activity
public class PDFview extends Activity {
ImageButton im;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
Intent intent = getIntent();
String LinkTo = intent.getExtras().getString("link");
WebView mWebView= new WebView(this);
im = new ImageButton(this);
im.setImageResource(R.drawable.back);
im.setLayoutParams(new LayoutParams(100,100));
im.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
exitPDF();
}
});
im.setLeft(0);
im.setTop(200);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("https://docs.google.com/gview?embedded=true&url="+LinkTo);
mWebView.addView(im);
setContentView(mWebView);
}