android-tablelayout

TableRow rescales after all elements of row are clicked

走远了吗. 提交于 2019-12-12 01:49:39
问题 I am creating a Table of buttons, to control a LED Matrix via Bluetooth. I have found on the web Brian's Video Tutorials and followed his Dynamic Buttons and Images video to implement this. Here is the code: public class DrawerMode extends Activity { private static final int NUMOFCOL = 15; private static final int NUMOFROW = 8; Button buttons[][] = new Button[NUMOFROW][NUMOFCOL]; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Assign

How to create a regular, resizable grid without nested weights?

拟墨画扇 提交于 2019-12-12 01:39:22
问题 I've one of the simplest layouts imaginable: A num pad. I want to create a fragment containing a 3 x 4 grid of buttons. The layout should automatically resize the num pad to fill the available space. I've learned, that GridLayout is not up to the task, and TableLayout/TableRow or nesting LinearLayouts means nesting weights, which is also discouraged for performance reasons. A RelativeLayout won't work either, because that requires at least one button with given dimensions. So, is there a

Getting data from TableLayout?

半世苍凉 提交于 2019-12-11 18:42:26
问题 When I'm trying to get the values to calculate the total I'm unable to get the values, instead getting android.widget.TableRow@4103c468 . How can I overcome this situation and more I need to pass those values to another Activity . My code: public class ProvisionActivity extends Activity { private TableLayout mTable; private static int sCount = 0; Button btnAdd; String[] pnames = { "provision1", "provision2", "provision3", "provision4", "provision5" }; String[] pprice = { "45", "85", "125",

Android: Stop EditText from going outside of tablerow

六眼飞鱼酱① 提交于 2019-12-11 16:50:09
问题 So i have a tablelayout in android with some table rows. In each row i have a textview and an edittext. My setup looks like: <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="5dp" android:paddingRight="5dp" android:paddingTop="10dp" android:stretchColumns="3" > <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_marginBottom="5dp" android:paddingTop="5dp" android:paddingBottom="5dp" android

Android spinner loads multicolumn (joined) Sqlite database into a table

青春壹個敷衍的年華 提交于 2019-12-11 11:56:19
问题 I am learning how to create a spinner that loads dropdown from SQLite. I have an UI that consists of a spinner and a table. If user clicks spinner, the table's content will load according to the database based on the selected ID on spinner. If name not selected, it will load all contents in table.. However I can't find the way how to make the table reload based on the ID / name selected on spinner. Anyone can guide me? The table itself is a joined table, which has following structure: Table A

Android TableLayout remove padding

 ̄綄美尐妖づ 提交于 2019-12-11 11:27:39
问题 What I'm trying to do is to remove every padding and margin from a TableLayout , and display the children buttons tiled. This is the activity_main.xml code <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity

How to use weights to arrange Gridview Items programmatically with TableLayout

廉价感情. 提交于 2019-12-11 04:19:37
问题 I am working on a Suduko solver app. I want the layout to have 9x9 TextView in 9 Gridviews. I want to put below them two buttons (Solve, clear). I have made it but it does not work probably with small devices (Can`t see the buttons and the Grid view turned to scrollable that does not fit the screen) Here is how I add Textviews to the Gridview gridView = (GridView) findViewById(R.id.gridView1); String[] arrayEmpty = new String[] {"", "", "", "", "", "", "", "", ""}; ArrayList<String> listEmpty

TextView not always expanding to a second line in TableLayout

妖精的绣舞 提交于 2019-12-11 04:07:43
问题 I have an app that is pulling information from a json file: { "EVENTS": [ { "what": " TABLE-QUIZ", "who": "anyone", "when": "31st January", "where": "ABC HELLO" } ] } When I run the app, sometimes the text in the column When is cut off on smaller screens when it goes onto a second line. If the text in the What column is too big it will go onto a second line and not get cut off. Why is the When column not going onto the second line while the What column is? Here is the layout xml that I am

Programmatically set TextView gravity right in a TableRow

混江龙づ霸主 提交于 2019-12-11 02:33:32
问题 I know this has been asked several times over, but can't seem to get it to work correctly in my situation. I am trying to get the last column to align right in a table that is generated programatically. I know I need to apply the LayoutParams to the row and all the inner children, and I know that I need to set the Gravity to the TextView, not the row, but I have tried all the permutations I can think of and can't seem to get the last column to align right. Here is my XML layout: <!--Open

Delete row dynamically from table layout in android

时光毁灭记忆、已成空白 提交于 2019-12-10 10:33:57
问题 I am having a TableLayout for which I added rows dynamically. In each of the row there are 2 elements of which one is TextView other is Button . When I click the button that is present in a row, that row should be deleted. How can this be done in Android ? How to find rowid and how to delete a row dynamically. Can anyone help me in sorting out this issue. 回答1: onClick on the button will give you the clicked view, the button in your case. That button's parent is the row you want to delete.