Android. Positioning of the elements in relativelayot -
i have relativelayout cardview, inside placed: imageview, textview1, textview2. these 3 elements needed place imageview must left, textview1 , textview2 right of it. textview2 must pressed bottom of cardview, @ same time below of textview1 (if textview1 has text). there no questions first 2 elements, there problems 3 (second textview): or pressed bottom, overlaped first textview(if first textview has text), or below of textview1, not pressed bottom. layout:
<android.support.v7.widget.cardview android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardbackgroundcolor="@color/colorbackground"> <relativelayout android:id="@+id/card_view_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp"> <imageview android:id="@+id/news_photo" android:layout_width="@dimen/news_card_view_width" android:layout_height="@dimen/news_card_view_height" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_alignparenttop="true" android:layout_marginend="16dp" android:layout_marginright="16dp" android:contentdescription="@string/news_card_view_photo" /> <textview android:id="@+id/news_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_toendof="@+id/news_photo" android:layout_torightof="@+id/news_photo" android:textsize="16sp" /> <textview android:id="@+id/news_date" android:textcolor="@color/text_labels" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_below="@+id/news_title" android:layout_torightof="@+id/news_photo" android:layout_toendof="@+id/news_photo"/> </relativelayout> </android.support.v7.widget.cardview> what want do:
add android:gravity="bottom" news_date textview.
<textview android:id="@+id/news_date" android:textcolor="@color/text_labels" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_below="@+id/news_title" android:layout_torightof="@+id/news_photo" android:layout_toendof="@+id/news_photo" android:gravity="bottom"/> 
Comments
Post a Comment