I am new To android world .I use Dynamic table layout.I create txtbox i added value but i divide the all txtbox width same . when if the length of text exceed some text hided .Can any one help to fix the isssue
Xml: <TableLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <TableRow android:layout_width="match_parent" android:layout_height="wrap_content" android:weightSum="1"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="1" android:layout_weight="0.2" android:background="@drawable/cell" android:gravity="center" android:paddingBottom="3dp" android:paddingTop="3dp" android:text="Name" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="2" android:layout_weight="0.2" android:background="@drawable/cell" android:gravity="center" android:paddingBottom="3dp" android:paddingTop="3dp" android:text="Email" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="3" android:layout_weight="0.2" android:background="@drawable/cell" android:gravity="center" android:paddingBottom="3dp" android:paddingTop="3dp" android:text="Profile" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="4" android:layout_weight="0.2" android:background="@drawable/cell" android:gravity="center" android:paddingBottom="3dp" android:paddingTop="3dp" android:text="Edit" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="5" android:layout_weight="0.2" android:background="@drawable/cell" android:gravity="center" android:paddingBottom="3dp" android:paddingTop="3dp" android:text="Remove" /> </TableRow> </TableLayout> <TableLayout android:id="@+id/summaryTable" android:layout_width="match_parent" android:layout_height="match_parent" android:singleLine="false" android:stretchColumns="*"></TableLayout> Android: maddnewchoche = (Button) findViewById(R.id.btn_addcoache); tableLayout = (TableLayout) findViewById(R.id.summaryTable); SharedPreferences pref2 = getSharedPreferences("userid", MODE_PRIVATE); int user_id = pref2.getInt("id", 0); DataBaseHandler db = new DataBaseHandler(getApplicationContext()); List<Editmylog_adapter> temp = db.geteditcoche(user_id); for (Editmylog_adapter cm : temp) { System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + cm.getMail() + cm.getName() + cm.getProfile() + cm.getDate()); } for (Editmylog_adapter cm : temp) { TableRow tableRow = new TableRow(this); name1 = new TextView(this); profile = new TextView(this); mail = new TextView(this); edit = new TextView(this); delete = new TextView(this); tableRow.setId(Integer.parseInt(cm.getDate())); tableRow.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT)); name1.setId(Integer.parseInt(cm.getDate())); name1.setText(cm.getName()); name1.setPadding(0, 20, 5, 20); name1.setGravity(Gravity.CENTER); name1.setTextColor(Color.parseColor("#ffffff")); name1.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE); name1.setLayoutParams(new TableRow.LayoutParams(20, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.2f)); tableRow.addView(name1); mail.setId(Integer.parseInt(cm.getDate())); mail.setText(cm.getMail()); mail.setPadding(0, 20, 5, 20); mail.setGravity(Gravity.CENTER); mail.setTextColor(Color.parseColor("#ffffff")); mail.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE); mail.setLayoutParams(new TableRow.LayoutParams(20, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.2f)); tableRow.addView(mail); profile.setId(Integer.parseInt(cm.getDate())); profile.setText(cm.getProfile()); profile.setPadding(0, 20, 5, 20); profile.setTextColor(Color.parseColor("#ffffff")); profile.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE); profile.setGravity(Gravity.CENTER); profile.setLayoutParams(new TableRow.LayoutParams(20, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.2f)); tableRow.addView(profile); edit.setId(Integer.parseInt(cm.getDate())); edit.setText("Edit"); edit.setPadding(0, 20, 5, 20); edit.setTextColor(Color.parseColor("#ffffff")); edit.setPaintFlags(delete.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); edit.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE); edit.setGravity(Gravity.CENTER); edit.setLayoutParams(new TableRow.LayoutParams(20, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.2f)); tableRow.addView(edit); delete.setId(Integer.parseInt(cm.getDate())); delete.setText("Remove"); delete.setTextColor(Color.parseColor("#ffffff")); delete.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE); delete.setGravity(Gravity.CENTER); delete.setPadding(0, 20, 5, 20); delete.setPaintFlags(delete.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); delete.setLayoutParams(new TableRow.LayoutParams(20, TableRow.LayoutParams.WRAP_CONTENT, 0.2f)); tableRow.addView(delete); tableLayout.addView(tableRow, new TableLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); i++; }
No comments:
Post a Comment