android - Percentage widths AND overlapping with xml -
i'm trying replicate this:
in android app. 3 textviews have percentage based width (33%) across screen. triangle separate drawable i've created.
the issue is, can create percentage width in linearlayout
, can't have nicely overlapping view in linearlayout
- basic info textview should behind triangle.
below code i've got working without triangle:
styles:
<style name="status_selected_textview"> <item name="android:layout_width">0dp</item> <item name="android:layout_height">@dimen/standard_line_height</item> <item name="android:layout_weight">0.33</item> <item name="android:gravity">center</item> <item name="android:textstyle">bold</item> <item name="android:textsize">@dimen/font_size_medium</item> <item name="android:textcolor">@android:color/white</item> <item name="android:padding">5dp</item> <item name="android:background">@color/green</item> </style> <style name="status_unselected_textview"> <item name="android:layout_width">0dp</item> <item name="android:layout_height">@dimen/standard_line_height</item> <item name="android:layout_weight">0.33</item> <item name="android:gravity">center</item> <item name="android:textstyle">bold</item> <item name="android:textsize">@dimen/font_size_medium</item> <item name="android:textcolor">@color/gray</item> <item name="android:padding">5dp</item> <item name="android:background">@color/light_header</item> </style>
layout:
<linearlayout android:id="@+id/activate_key_status_header" android:layout_below="@+id/activate_key_header" android:layout_width="match_parent" android:layout_height="wrap_content" android:backround="@color/light_header"> <textview android:id="@+id/activate_key_textview" android:text="activate key" style="@style/status_selected_textview"/> <textview style="@style/status_unselected_textview" android:text="basic info" /> <textview android:text="edit profile" style="@style/status_unselected_textview"/> </linearlayout>
here code triangle i'm trying add somehow:
<view android:layout_torightof="@+id/activate_key_textview" android:layout_width="@dimen/standard_line_height" android:layout_height="@dimen/standard_line_height" android:background="@drawable/arrow_right" />
it seems solution somehow combo of relativelayout
, linearlayout
, can't seem find right way.
any thoughts?
can wrap 2nd textview in framelayout, , add triangle view 2nd? plus android:gravity
left it, think.
something this:
<framelayout <!-- whatever styles need make fit 33%--> > <textview style="@style/status_unselected_textview" android:text="basic info" /> <view android:gravity="left" android:layout_width="@dimen/standard_line_height" android:layout_height="@dimen/standard_line_height" android:background="@drawable/arrow_right" /> </framelayout>
Comments
Post a Comment