14487

Locked first element in android sliding menu

Question:

I'm designing android side sliding menu based on examples with navigation drawer pattern like this :

<android.support.v4.widget.DrawerLayout > <FrameLayout> ... </FrameLayout> <ListView> ... </ListView> </android.support.v4.widget.DrawerLayout>

To achieve something like this:

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/rsASH.jpg" data-original="https://i.stack.imgur.com/rsASH.jpg" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

In upper case we have view(2) as ListView but how to put in that menu locked element like (1) one, regarding to upper xml. I've tryied enclosing ListView in relative/linear layout like:

<android.support.v4.widget.DrawerLayout > <FrameLayout> ... </FrameLayout> <LinearLayout> <TextView/> <ListView> ... </ListView> </LinearLayout> </android.support.v4.widget.DrawerLayout>

but it brings no result. Any ideas ?

Answer1:

Change your layout as below. This will work fine. Make changes in linear layout for your top user details.

<android.support.v4.widget.DrawerLayout> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_parent" android:layout_height="match_parent" > </FrameLayout> <FrameLayout android:id="@+id/drawerContainer" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="start" android:layout_marginRight="20dp" > <LinearLayout android:id="@+id/slide_menu_ll_user" android:layout_width="match_parent" android:layout_height="72dp" android:layout_gravity="left" android:clickable="true" android:focusable="true" android:orientation="horizontal" > <TextView /> <ImageButton /> </LinearLayout> <ListView /> </FrameLayout> </android.support.v4.widget.DrawerLayout>

Recommend

  • Set LayoutParams on parentless LinearLayout
  • Flash screen Android
  • how to debug an internal error?
  • Javadoc generation for Android
  • Attaching a fixed, transparent, header to a ListView?
  • Difference between enum and enum class [duplicate]
  • Pandas multi-index subtract from value based on value in other column
  • Float Label hint (TextInputLayout) not works with Android Data Binding
  • creating password field in oracle
  • Fancy dynamic list in Android: TableLayout vs ListView
  • React Native fetch is not a function
  • UWP change ComboBox position when opening
  • Scala split a multi line string by lines that contain all hyphens
  • EntLib Way to Bind “Null” Value to Parameter
  • WPF version of .ScaleControl?
  • Django model inheritance, filtering models
  • Query to find the duplicates between the name and number in table
  • Avoid links criss cross / overlap in d3.js using force layout
  • Handling un-mapped Rest path
  • Java: can you cast Class into a specific interface?
  • Paperclip, set path outside of rails root folder
  • AES padding and writing the ciphertext to a disk file
  • Is possible to count alias result on mysql
  • Updating server-side rendering client-side
  • script to move all files from one location to another location
  • How to extract text from Word files using C#?
  • How to make Safari send if-modified-since header?
  • How to pass list parameters for each object using Spring MVC?
  • Cannot Parse HTML Data Using Android / JSOUP
  • Benchmarking RAM performance - UWP and C#
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • Getting Messege Twice Using IMvxMessenger
  • Memory offsets in inline assembly
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • JaxB to read class hierarchy
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • How to load view controller without button in storyboard?