I'm trying to overlay a semi-transparent text box over a photo for description. Tapping on the screen should make it slide up/down. It should also contain a rating bar in the bottom.
Much like in Google Goggles http://blogote.com/wp-content/uploads/2010/10/GoogleGoggles1.jpg
How would you do it? This is what I have so far:
<FrameLayout
android:id="@+id/mainlayout"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:foregroundGravity="bottom"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:id="@+id/imgview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="@string/hello"/>
</FrameLayout>
This can be easily implemented with a
RelativeLayout
and aSlidingDrawer
widget.RelativeLayout
is required so that you can attach the drawer to the bottom of the layout and have it open over the photo.SlidingDrawer
widget has 2 required properties:android:handle
andandroid:content
. For clean layouts, you'll probably want these as separate layout files. For simplicity in the below example, they're included in the same XML layout.android:background
property as a ARGB (Alpha RGB) value. Below uses "#BF000000" which is black at roughly 75% opacity.ImageView
and yourSlidingDrawer
.Just for kicks, here's a full working example...
Your layout XML:
And your activity Java: