Android layout issue - item is hidden when other view is too long -
hello creating layout list of users name , notification icon. problem name (green rectangle) can have width , when name long notification icon (red rectangle) hidden container (black rectangle) bounds.
http://postimg.org/image/6o7np9lx3/
what should that, when notification icon gone name can take width container allow. when notification icon appears never should hide on right side of container, move right side. , notification icon should on right side of name. last thing width of container depends on screen width.
so this:
http://postimg.org/image/94a0rxy1d/
- notification , short text
- notification , long text
- no notification , long text
hope clear:-) , upload image here directly, don't have enough reputation...
edit: adding layout created:
<relativelayout android:minwidth="25px" android:minheight="25px" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/relativelayout3" android:paddingtop="0dp" android:paddingright="0dp" android:paddingbottom="0dp" android:paddingleft="0dp" android:layout_margintop="8dp"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/cmcname" android:layout_centervertical="true" android:ellipsize="middle" android:textsize="16dp" android:textstyle="bold" android:textcolor="#ff181818" /> <relativelayout android:minwidth="25px" android:minheight="25px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/relativelayout4" android:layout_torightof="@id/cmcname" android:layout_marginleft="7dp"> <imageview android:src="@android:drawable/ic_menu_gallery" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/cmcmessagecounterbg" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/cmcmessagecounter" android:layout_centerinparent="true" /> </relativelayout> </relativelayout>
if icon static can directly put drawable right textview , work fine.
<textview android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_centervertical="true" android:drawableright="@drawable/ic_launcher" android:gravity="left|center" android:padding="10dp" android:text="your text goes here" />
hope works. :)
Comments
Post a Comment