android-tablelayout

Manage scroll position in scrollview during orientation change

邮差的信 提交于 2019-12-06 16:52:48
I have a Bookshelf which is implemented as follows: I have a ScrollView which contains a nested TableLayout which acts as a container for dynamically generated TableRows. <com.test.bookshelf.CustomScrollView android:id="@+id/scrollview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/newHeader" android:overScrollMode="never" android:fadingEdge="none" > <TableLayout android:id="@+id/tblLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="0dp" > </TableLayout> </com.test.bookshelf.CustomScrollView>

Delete row dynamically from table layout in android

☆樱花仙子☆ 提交于 2019-12-06 13:41:56
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. 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. Deleting that row from it's parent will get rid of it. An example of how you could implement this: button

Programmatically set border for TableRow array

被刻印的时光 ゝ 提交于 2019-12-06 09:23:47
问题 I know it is the same question as here But it hasn't receive an answer yet, so I try it here, becuase I need it too :) I got an Array: (I shortend the array/code for SO) ScrollView sv = new ScrollView(this); TableLayout ll=new TableLayout(this); HorizontalScrollView hsv = new HorizontalScrollView(this); TableRow tbrow=new TableRow(this); for(int i=0;i<mConnector.idArray.size();i++) { tbrow=new TableRow(this); tbrow.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, 1

Make cells same width and height to fill the table

余生颓废 提交于 2019-12-06 07:13:57
问题 I'm trying to learn how to use table layouts in android, this is my code: <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tableLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" > <!-- 3 columns --> <TableRow android:id="@+id/tableRow3" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dip" > <TextView android:id="@+id/textView2" android:text=

How to put a very long table layout inside the horizontal Scroll view in the CORRECT way?

空扰寡人 提交于 2019-12-06 06:16:00
I tried looking at numerious examples and posts but none of them matches my problem. I need to make a very long (horizontal) table with many columns so it is impossible to display in a single screen. And I don't want to spilt the table because it is important that I display my table in this way. I have pasted my XML layout below (including the main important ones) The thing is if I remove the code: android:fillViewport="true" from the HorizontalScrollView then my table inside it, gets squeezed in one place, especially at the left side of it. It doesn't even use much of this

TableLayout of radiogroup(s) with respective label(s) aligned in android

时间秒杀一切 提交于 2019-12-06 05:46:29
I'm creating a feedback input form which takes user selection from radio buttons just like below image. So i took a table layout and added table rows with textviews of fixed width in first row and a textview with radio buttons of fixed width for the remaining rows Here is the layout code: <HorizontalScrollView android:layout_width="match_parent" android:layout_height="wrap_content"> <TableLayout android:showDividers="middle" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TableRow> <TextView android:id="@+id/name" android:layout_width="100dp" android:layout_height=

Is it possible to specify TableRow height?

笑着哭i 提交于 2019-12-06 04:41:56
问题 I have a TableLayout with multiple TableRow views inside it. I wish to specify the height of the row programatically. E.g. int rowHeight = calculateRowHeight(); TableLayout tableLayout = new TableLayout(activity); TableRow tableRow = buildTableRow(); TableLayout.LayoutParams rowLp = new TableLayout.LayoutParams( LayoutParams.FILL_PARENT, rowHeight); tableLayout.addView(tableRow, rowLp); But this isn't working and is defaulting to WRAP_CONTENT. Digging around in the Android source code, I see

Change image on Tab in TabLayout when Selected

回眸只為那壹抹淺笑 提交于 2019-12-06 03:51:20
问题 I am using Design TabLayout, <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" app:tabBackground="@color/ColorPrimary" app:tabIndicatorColor="@color/orange" app:tabIndicatorHeight="3dp" /> I have added customview to Tabs <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"

Android - Dynamically Adding TableRow to TableLayout using an existing TableRow layout

送分小仙女□ 提交于 2019-12-06 01:44:17
I'm trying to adding TableRows to a TableLayout, which is working fantastically. However, I'm running into some problems with layout parameters. The spacing between the TextViews within a TableRow isn't working out like I thought it would. My current code looks as follows. paymentTable = (TableLayout) findViewById(R.id.paymentTable); for(i = 0; i < cursor.getCount(); i++) { TableRow row = new TableRow(this); TextView payAmount = new TextView(this); payAmount.setText(cursor.getString(cursor.getColumnIndex(DatabaseHelper.KEY_AMOUNT))); payAmount.setPadding(payAmount.getPaddingLeft(), payAmount

How to create a pagination for dynamically created table layout using set visible?

◇◆丶佛笑我妖孽 提交于 2019-12-05 16:04:20
I am getting data from server and create the tablelayout dynamically for that response, now I need to show only 5 rows per page, I am using setvisible(view.invisible) to hide all the table rows, How to set the 5 rows setvisible(view.visible) to show the rows like pagination ? The code I used to create the table dynamically is below. TableLayout tableLayout = (TableLayout) findViewById(R.id.tablenew); TableRow tableRow = new TableRow(this); tableRow.setId(1); tableRow.setBackgroundColor(Color.LTGRAY); tableRow.setPadding(0,0,1,1); tableRow.setLayoutParams(new TableLayout.LayoutParams());