Android : DrawerLayout background for ListView

on Tuesday, July 8, 2014


I have the following for my DrawerLayout:



<?xml version="1.0" encoding="utf-8"?>

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_main">

<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<!-- Listview to display slider menu -->
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@drawable/background"
android:choiceMode="singleChoice"
android:divider="@color/transparent"
android:dividerHeight="0dp" />

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


I want to have a background image for my ListView with a black view on top of it that has some opacity. For my iPhone app it's very easy--I just have a UIImageView with a UIView on top that has a black background and opacity of .4 and everything works.


Is there a way to do this in Android? Also, this image will be downloaded from the server...so I need to fit that constraint as well.


0 comments:

Post a Comment