android - I can't make the textview right of the cell inside grid view -
what have custom grid view , each row contains 5 columns , inside each cell have text view , want text view in right side of cell keeps showing on left side .. image :
and here grid view xml file :
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity" tools:ignore="mergerootframe" android:layout_gravity="right" > <gridview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/mygridview" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:gravity="right" android:layout_margintop="60dp" android:numcolumns="5" android:textdirection="rtl"/> </relativelayout>
and here textview style xml file :
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <textview android:id="@+id/grid_item" android:layout_width="318dp" android:layout_height="wrap_content" android:gravity="right" android:text="medium text" android:textalignment="gravity" android:textappearance="?android:attr/textappearancemedium" android:textcolor="#000000" android:textsize="20sp" /> </linearlayout>
and here main activity :
public class myordernew extends activity { private textview text; private gridview gridview; private final string[] items = new string[]{"ملاحظات","مربع المساحة","الإرتفاع","العرض","الصنف","7","8","9","10","11"}; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.cart); gridview = (gridview) this.findviewbyid(r.id.mygridview); gridview.setbackgroundcolor(color.blue); gridview.setverticalspacing(1); gridview.sethorizontalspacing(1); customgridadapter gridadapter = new customgridadapter(myordernew.this, items); gridview.setadapter(gridadapter);
can me fix problem?
give width fill parent text view , give gravity right. or layout gravity right.
Comments
Post a Comment