Note that there are some explanatory texts on larger screens.

plurals
  1. POSlidingMenu not showing properly
    text
    copied!<p>I'm a Beginner Android Programmer and I'm toying around with <a href="https://github.com/jfeinstein10/SlidingMenu">JFeinstein's awesome sliding menu</a>, trying to figure out how it works and implement it in my apps but in all of my implementations the behind view covers 100% of the above view. </p> <p>Also, the only way to go back to the above view is to press the back button, so no <code>"sliding"</code> back either. If I understand correctly, this should be controlled by the <code>BehindViewOffset</code>, yet I don't seem to be getting it to work. Anyway, here's a little sample code:</p> <p>Here's my <code>MainActivity</code>:</p> <pre><code>public class MainActivity extends SlidingActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setBehindContentView(R.layout.testing); populate(); SlidingMenu menu = new SlidingMenu(this); menu.setMode(SlidingMenu.LEFT); menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN); menu.setBehindOffsetRes(R.dimen.slidingmenu_offset); menu.setFadeDegree(0.35f); menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT); setSlidingActionBarEnabled(true); menu.setMenu(R.layout.testing); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: toggle(); return true; default: return super.onOptionsItemSelected(item); } } private void populate() { ListView lv = (ListView) findViewById(R.id.listView1); String[] values = new String[] { "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten" }; ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, android.R.id.text1, values); lv.setAdapter(adapter); } } </code></pre> <p>And the layout 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="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; </code></pre> <p>Sadly I can't post a screenshot until I earn more rep!</p> <p><strong>Edit:</strong> Added the dimen.xml</p> <pre><code> &lt;resources&gt; &lt;dimen name="slidingmenu_offset"&gt;120dp&lt;/dimen&gt; &lt;dimen name="list_padding"&gt;10dp&lt;/dimen&gt; &lt;dimen name="shadow_width"&gt;15dp&lt;/dimen&gt; &lt;integer name="num_cols"&gt;1&lt;/integer&gt; &lt;/resources&gt; </code></pre>
 

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