Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get buttons to display above WebView
    text
    copied!<p>I am aware that this question has been asked before, but I have tried every "solution" to the other questions, but I still have not been able to achieve what I am trying to do. I have searched and searched, and tried and tried. Please forgive me. I simply want to display my row of buttons above my WebView, so that it is consistent with the rest of the activities in my app (they all have the row of buttons at the top). It seems like I have tried every possible combination of layouts, but to no avail. It displays correctly in the Graphical Layout (Eclipse), but on the phone and emulator it only displays the WebView, fullscreen, no buttons.... Any help will be very much appreciated!</p> <p>Here's my xml:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/menu_panel"&gt; &lt;ImageButton android:id="@+id/bHomeMenu" android:layout_margin="-8dip" android:layout_width="65dp" android:layout_height="90dp" android:background="@drawable/menu_btn_hcu_light_blue" android:src="@drawable/icon_menu_home" android:adjustViewBounds="true" android:scaleType="centerInside" style="@style/ButtonText" android:textSize="13sp" android:text="Home" /&gt; &lt;ImageButton android:id="@+id/bItsMe247Menu" android:layout_toRightOf="@+id/bHomeMenu" android:layout_margin="-8dip" android:layout_width="65dp" android:layout_height="90dp" android:background="@drawable/menu_btn_selected_hcu_light_blue" android:src="@drawable/icon_menu_login" android:adjustViewBounds="true" android:scaleType="centerInside" style="@style/ButtonText" android:textSize="13sp" android:text="It'sMe" /&gt; &lt;ImageButton android:id="@+id/bFindUsMenu" android:layout_toRightOf="@+id/bItsMe247Menu" android:layout_margin="-8dip" android:layout_width="65dp" android:layout_height="90dp" android:background="@drawable/menu_btn_hcu_light_blue" android:src="@drawable/icon_menu_find_us" android:adjustViewBounds="true" android:scaleType="centerInside" style="@style/ButtonText" android:textSize="13sp" android:text="FindUs" /&gt; &lt;ImageButton android:id="@+id/bEmailMenu" android:layout_toRightOf="@+id/bFindUsMenu" android:layout_margin="-8dip" android:layout_width="65dp" android:layout_height="90dp" android:background="@drawable/menu_btn_hcu_light_blue" android:src="@drawable/icon_menu_email" android:adjustViewBounds="true" android:scaleType="centerInside" style="@style/ButtonText" android:textSize="13sp" android:text="Email" /&gt; &lt;ImageButton android:id="@+id/bRatesMenu" android:layout_toRightOf="@+id/bEmailMenu" android:layout_margin="-8dip" android:layout_width="65dp" android:layout_height="90dp" android:background="@drawable/menu_btn_hcu_light_blue" android:src="@drawable/icon_menu_rates" android:adjustViewBounds="true" android:scaleType="centerInside" style="@style/ButtonText" android:textSize="13sp" android:text="Rates" /&gt; &lt;/LinearLayout&gt; &lt;WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/wvItsMe" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" /&gt; &lt;/LinearLayout&gt; </code></pre> <p><strong>EDIT</strong>: Here's my java code, and a note below it:</p> <pre><code> package com.dummyapp.app; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.MotionEvent; import android.view.Window; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Toast; import com.dummyapp.app.SimpleGestureFilter.SimpleGestureListener; public class ItsMe247 extends Activity implements SimpleGestureListener{ private SimpleGestureFilter detector; private WebView itsMeLogin; // ImageButton menuHome, menuFindUs, menuEmail, menuRates; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); //setContentView(R.layout.itsme247); // menuHome = (ImageButton)findViewById(R.id.bHomeMenu); // menuFindUs = (ImageButton)findViewById(R.id.bFindUsMenu); // menuEmail = (ImageButton)findViewById(R.id.bEmailMenu); // menuRates = (ImageButton)findViewById(R.id.bRatesMenu); detector = new SimpleGestureFilter(this,this); itsMeLogin = new WebView(this); Toast.makeText(this, "Just Swipe To Exit", Toast.LENGTH_LONG).show(); itsMeLogin.getSettings().setJavaScriptEnabled(true); // JavaScript enabled getWindow().requestFeature(Window.FEATURE_PROGRESS); // Show progress bar of page loading final Activity itsMeActivity = this; itsMeLogin.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress){ // Activities and WebViews measure progress with different scales. // The progress meter will automatically disappear when we reach 100% itsMeActivity.setProgress(progress * 100); } }); itsMeLogin.setWebViewClient(new WebViewClient(){ public void onReceivedError(WebView view, int errorCode, String description, String failingUrl){ Toast.makeText(itsMeActivity, "Oh no! " + description, Toast.LENGTH_SHORT).show(); } }); itsMeLogin.loadUrl("http://www.google.com"); setContentView(itsMeLogin); // itsMeLogin.setWebViewClient(new WebViewClient() { // @Override // public boolean shouldOverrideUrlLoading(final WebView view, final String url) { // return super.shouldOverrideUrlLoading(view, url); // } // }); //******************* MENU BUTTONS START HERE ********************************************************// // menuRates.setOnClickListener(new View.OnClickListener() { // // public void onClick(View v) { // // TODO Auto-generated method stub // Intent ratesIntent = new Intent(ItsMe247.this, Rates.class); // ItsMe247.this.startActivity(ratesIntent); // // } // // }); // // // menuFindUs.setOnClickListener(new View.OnClickListener() { // // public void onClick(View v) { // // TODO Auto-generated method stub // Intent contactIntent = new Intent(ItsMe247.this, Contact.class); // ItsMe247.this.startActivity(contactIntent); // // } // }); // // menuEmail.setOnClickListener(new View.OnClickListener() { // // public void onClick(View v) { // // TODO Auto-generated method stub // Intent emailIntent = new Intent(ItsMe247.this, Email.class); // ItsMe247.this.startActivity(emailIntent); // // // } // }); // // menuHome.setOnClickListener(new View.OnClickListener() { // // public void onClick(View v) { // // TODO Auto-generated method stub // Intent itsMeIntent = new Intent(ItsMe247.this, MainActivity.class); // ItsMe247.this.startActivity(itsMeIntent); // } // }); //***************************** MENU BUTTONS END HERE ********************************************************// }//end onCreate method @Override public boolean dispatchTouchEvent(MotionEvent me){ this.detector.onTouchEvent(me); return super.dispatchTouchEvent(me); } public void onSwipe(int direction) { switch (direction) { case SimpleGestureFilter.SWIPE_RIGHT: Intent funIntent = new Intent(ItsMe247.this, MainActivity.class); ItsMe247.this.startActivity(funIntent); //ItsMe247.this.finish(); break; case SimpleGestureFilter.SWIPE_LEFT: Intent funIntent2 = new Intent(ItsMe247.this, Contact.class); ItsMe247.this.startActivity(funIntent2); //ItsMe247.this.finish(); break; case SimpleGestureFilter.SWIPE_DOWN: break; case SimpleGestureFilter.SWIPE_UP: break; } }//end onSwipe method public void onDoubleTap() { } } </code></pre> <p>I have all the menu buttons commented out (the buttons I'm trying to get to display above webview) until I finally get them to display through the xml. However, whenever I UNcomment the buttons and their listeners, the app crashes when trying to enter this activity.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload