Created
July 24, 2014 20:51
-
-
Save DanielGrech/e0734adc27a614569873 to your computer and use it in GitHub Desktop.
Layout for an image with 2 labels at the bottom. Overlay is applied to bleed out any images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<ImageView | |
android:id="@+id/image" | |
android:layout_width="match_parent" | |
android:scaleType="centerCrop" | |
android:layout_height="200dp" /> | |
<View | |
android:layout_width="match_parent" | |
android:layout_height="200dp" | |
android:background="@drawable/overlay_gradient" /> | |
<LinearLayout | |
android:id="@+id/text_wrapper" | |
style="@style/ImageWithOverlappingLabel.Label.Wrapper"> | |
<TextView | |
android:id="@+id/text1" | |
style="@style/ImageWithOverlappingLabel.Label.Title" /> | |
<TextView | |
android:id="@+id/text2" | |
style="@style/ImageWithOverlappingLabel.Label.Subtitle" /> | |
</LinearLayout> | |
</FrameLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shape="rectangle"> | |
<gradient | |
android:startColor="#88000000" | |
android:endColor="#33000000" | |
android:angle="90" | |
android:type="linear" /> | |
</shape> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style name="ImageWithOverlappingLabel" /> | |
<style name="ImageWithOverlappingLabel.Label.Wrapper"> | |
<item name="android:layout_width">match_parent</item> | |
<item name="android:layout_height">wrap_content</item> | |
<item name="android:orientation">vertical</item> | |
<item name="android:layout_gravity">bottom</item> | |
<item name="android:paddingLeft">16dp</item> | |
<item name="android:paddingRight">16dp</item> | |
<item name="android:paddingTop">4dp</item> | |
<item name="android:paddingBottom">4dp</item> | |
</style> | |
<style name="ImageWithOverlappingLabel.Label"> | |
<item name="android:layout_width">match_parent</item> | |
<item name="android:layout_height">wrap_content</item> | |
<item name="android:textColor">@android:color/white</item> | |
<item name="android:maxLines">1</item> | |
<item name="android:ellipsize">end</item> | |
</style> | |
<style name="ImageWithOverlappingLabel.Label.Title" parent="ImageWithOverlappingLabel.Label" > | |
<item name="android:textStyle">bold</item> | |
</style> | |
<style name="ImageWithOverlappingLabel.Label.Subtitle" parent="ImageWithOverlappingLabel.Label" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment