TableLayout not scrolling

Put your problem here if it does not fit any of the other categories.

TableLayout not scrolling

Postby raquibulbari » Mon Jan 28, 2008 11:26 am

Hello all,
How is everything going? In my application i had a TableLayout in which i continuously add tablerows programmatically. After adding a lot of rows when i try to scroll down, i cannot do so. I thought may be it's my fault. So i made a simple xml with a lot of rows

Here is my xml file, in my application i just setContentView this layout.

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <TableLayout
  5.  
  6. id="@+id/widget26"
  7.  
  8. android:layout_width="wrap_content"
  9.  
  10. android:layout_height="wrap_content"
  11.  
  12. android:background="#ffffffff"
  13.  
  14. xmlns:android="http://schemas.android.com/apk/res/android"
  15.  
  16. android:orientation="vertical"
  17.  
  18. android:scrollbars="vertical"
  19.  
  20. >
  21.  
  22. <TableRow
  23.  
  24. id="@+id/widget28"
  25.  
  26. android:layout_width="fill_parent"
  27.  
  28. android:layout_height="wrap_content"
  29.  
  30. android:background="#ffffffff"
  31.  
  32. xmlns:android="http://schemas.android.com/apk/res/android"
  33.  
  34. android:orientation="horizontal"
  35.  
  36. >
  37.  
  38. <Button
  39.  
  40. id="@+id/widget51"
  41.  
  42. android:layout_width="wrap_content"
  43.  
  44. android:layout_height="wrap_content"
  45.  
  46. android:text="Button"
  47.  
  48. >
  49.  
  50. </Button>
  51.  
  52. </TableRow>
  53.  
  54. <TableRow
  55.  
  56. id="@+id/widget29"
  57.  
  58. android:layout_width="fill_parent"
  59.  
  60. android:layout_height="wrap_content"
  61.  
  62. android:background="#ffffffff"
  63.  
  64. xmlns:android="http://schemas.android.com/apk/res/android"
  65.  
  66. android:orientation="horizontal"
  67.  
  68. >
  69.  
  70. <Button
  71.  
  72. id="@+id/widget52"
  73.  
  74. android:layout_width="wrap_content"
  75.  
  76. android:layout_height="wrap_content"
  77.  
  78. android:text="Button"
  79.  
  80. >
  81.  
  82. </Button>
  83.  
  84. </TableRow>
  85.  
  86. <TableRow
  87.  
  88. id="@+id/widget30"
  89.  
  90. android:layout_width="fill_parent"
  91.  
  92. android:layout_height="wrap_content"
  93.  
  94. android:background="#ffffffff"
  95.  
  96. xmlns:android="http://schemas.android.com/apk/res/android"
  97.  
  98. android:orientation="horizontal"
  99.  
  100. >
  101.  
  102. <Button
  103.  
  104. id="@+id/widget53"
  105.  
  106. android:layout_width="wrap_content"
  107.  
  108. android:layout_height="wrap_content"
  109.  
  110. android:text="Button"
  111.  
  112. >
  113.  
  114. </Button>
  115.  
  116. </TableRow>
  117.  
  118. <TableRow
  119.  
  120. id="@+id/widget31"
  121.  
  122. android:layout_width="fill_parent"
  123.  
  124. android:layout_height="wrap_content"
  125.  
  126. android:background="#ffffffff"
  127.  
  128. xmlns:android="http://schemas.android.com/apk/res/android"
  129.  
  130. android:orientation="horizontal"
  131.  
  132. >
  133.  
  134. <Button
  135.  
  136. id="@+id/widget54"
  137.  
  138. android:layout_width="wrap_content"
  139.  
  140. android:layout_height="wrap_content"
  141.  
  142. android:text="Button"
  143.  
  144. >
  145.  
  146. </Button>
  147.  
  148. </TableRow>
  149.  
  150. <TableRow
  151.  
  152. id="@+id/widget32"
  153.  
  154. android:layout_width="fill_parent"
  155.  
  156. android:layout_height="wrap_content"
  157.  
  158. android:background="#ffffffff"
  159.  
  160. xmlns:android="http://schemas.android.com/apk/res/android"
  161.  
  162. android:orientation="horizontal"
  163.  
  164. >
  165.  
  166. <Button
  167.  
  168. id="@+id/widget55"
  169.  
  170. android:layout_width="wrap_content"
  171.  
  172. android:layout_height="wrap_content"
  173.  
  174. android:text="Button"
  175.  
  176. >
  177.  
  178. </Button>
  179.  
  180. </TableRow>
  181.  
  182. <TableRow
  183.  
  184. id="@+id/widget33"
  185.  
  186. android:layout_width="fill_parent"
  187.  
  188. android:layout_height="wrap_content"
  189.  
  190. android:background="#ffffffff"
  191.  
  192. xmlns:android="http://schemas.android.com/apk/res/android"
  193.  
  194. android:orientation="horizontal"
  195.  
  196. >
  197.  
  198. <Button
  199.  
  200. id="@+id/widget56"
  201.  
  202. android:layout_width="wrap_content"
  203.  
  204. android:layout_height="wrap_content"
  205.  
  206. android:text="Button"
  207.  
  208. >
  209.  
  210. </Button>
  211.  
  212. </TableRow>
  213.  
  214. <TableRow
  215.  
  216. id="@+id/widget34"
  217.  
  218. android:layout_width="fill_parent"
  219.  
  220. android:layout_height="wrap_content"
  221.  
  222. android:background="#ffffffff"
  223.  
  224. xmlns:android="http://schemas.android.com/apk/res/android"
  225.  
  226. android:orientation="horizontal"
  227.  
  228. >
  229.  
  230. <Button
  231.  
  232. id="@+id/widget57"
  233.  
  234. android:layout_width="wrap_content"
  235.  
  236. android:layout_height="wrap_content"
  237.  
  238. android:text="Button"
  239.  
  240. >
  241.  
  242. </Button>
  243.  
  244. </TableRow>
  245.  
  246. <TableRow
  247.  
  248. id="@+id/widget35"
  249.  
  250. android:layout_width="fill_parent"
  251.  
  252. android:layout_height="wrap_content"
  253.  
  254. android:background="#ffffffff"
  255.  
  256. xmlns:android="http://schemas.android.com/apk/res/android"
  257.  
  258. android:orientation="horizontal"
  259.  
  260. >
  261.  
  262. <Button
  263.  
  264. id="@+id/widget58"
  265.  
  266. android:layout_width="wrap_content"
  267.  
  268. android:layout_height="wrap_content"
  269.  
  270. android:text="Button"
  271.  
  272. >
  273.  
  274. </Button>
  275.  
  276. </TableRow>
  277.  
  278. <TableRow
  279.  
  280. id="@+id/widget36"
  281.  
  282. android:layout_width="fill_parent"
  283.  
  284. android:layout_height="wrap_content"
  285.  
  286. android:background="#ffffffff"
  287.  
  288. xmlns:android="http://schemas.android.com/apk/res/android"
  289.  
  290. android:orientation="horizontal"
  291.  
  292. >
  293.  
  294. <Button
  295.  
  296. id="@+id/widget59"
  297.  
  298. android:layout_width="wrap_content"
  299.  
  300. android:layout_height="wrap_content"
  301.  
  302. android:text="Button"
  303.  
  304. >
  305.  
  306. </Button>
  307.  
  308. </TableRow>
  309.  
  310. <TableRow
  311.  
  312. id="@+id/widget37"
  313.  
  314. android:layout_width="fill_parent"
  315.  
  316. android:layout_height="wrap_content"
  317.  
  318. android:background="#ffffffff"
  319.  
  320. xmlns:android="http://schemas.android.com/apk/res/android"
  321.  
  322. android:orientation="horizontal"
  323.  
  324. >
  325.  
  326. <Button
  327.  
  328. id="@+id/widget60"
  329.  
  330. android:layout_width="wrap_content"
  331.  
  332. android:layout_height="wrap_content"
  333.  
  334. android:text="Button"
  335.  
  336. >
  337.  
  338. </Button>
  339.  
  340. </TableRow>
  341.  
  342. <TableRow
  343.  
  344. id="@+id/widget38"
  345.  
  346. android:layout_width="fill_parent"
  347.  
  348. android:layout_height="wrap_content"
  349.  
  350. android:background="#ffffffff"
  351.  
  352. xmlns:android="http://schemas.android.com/apk/res/android"
  353.  
  354. android:orientation="horizontal"
  355.  
  356. >
  357.  
  358. <Button
  359.  
  360. id="@+id/widget61"
  361.  
  362. android:layout_width="wrap_content"
  363.  
  364. android:layout_height="wrap_content"
  365.  
  366. android:text="Button"
  367.  
  368. >
  369.  
  370. </Button>
  371.  
  372. </TableRow>
  373.  
  374. <TableRow
  375.  
  376. id="@+id/widget40"
  377.  
  378. android:layout_width="fill_parent"
  379.  
  380. android:layout_height="wrap_content"
  381.  
  382. android:background="#ffffffff"
  383.  
  384. xmlns:android="http://schemas.android.com/apk/res/android"
  385.  
  386. android:orientation="horizontal"
  387.  
  388. >
  389.  
  390. <EditText
  391.  
  392. id="@+id/widget62"
  393.  
  394. android:layout_width="wrap_content"
  395.  
  396. android:layout_height="wrap_content"
  397.  
  398. android:text="EditText"
  399.  
  400. >
  401.  
  402. </EditText>
  403.  
  404. </TableRow>
  405.  
  406. <TableRow
  407.  
  408. id="@+id/widget41"
  409.  
  410. android:layout_width="fill_parent"
  411.  
  412. android:layout_height="wrap_content"
  413.  
  414. android:background="#ffffffff"
  415.  
  416. xmlns:android="http://schemas.android.com/apk/res/android"
  417.  
  418. android:orientation="horizontal"
  419.  
  420. >
  421.  
  422. <Button
  423.  
  424. id="@+id/widget63"
  425.  
  426. android:layout_width="wrap_content"
  427.  
  428. android:layout_height="wrap_content"
  429.  
  430. android:text="Button"
  431.  
  432. >
  433.  
  434. </Button>
  435.  
  436. </TableRow>
  437.  
  438. <TableRow
  439.  
  440. id="@+id/widget42"
  441.  
  442. android:layout_width="fill_parent"
  443.  
  444. android:layout_height="wrap_content"
  445.  
  446. android:background="#ffffffff"
  447.  
  448. xmlns:android="http://schemas.android.com/apk/res/android"
  449.  
  450. android:orientation="horizontal"
  451.  
  452. >
  453.  
  454. <EditText
  455.  
  456. id="@+id/widget64"
  457.  
  458. android:layout_width="wrap_content"
  459.  
  460. android:layout_height="wrap_content"
  461.  
  462. android:text="EditText"
  463.  
  464. >
  465.  
  466. </EditText>
  467.  
  468. </TableRow>
  469.  
  470. <TableRow
  471.  
  472. id="@+id/widget43"
  473.  
  474. android:layout_width="fill_parent"
  475.  
  476. android:layout_height="wrap_content"
  477.  
  478. android:background="#ffffffff"
  479.  
  480. xmlns:android="http://schemas.android.com/apk/res/android"
  481.  
  482. android:orientation="horizontal"
  483.  
  484. >
  485.  
  486. <EditText
  487.  
  488. id="@+id/widget65"
  489.  
  490. android:layout_width="wrap_content"
  491.  
  492. android:layout_height="wrap_content"
  493.  
  494. android:text="EditText"
  495.  
  496. >
  497.  
  498. </EditText>
  499.  
  500. </TableRow>
  501.  
  502. <TableRow
  503.  
  504. id="@+id/widget44"
  505.  
  506. android:layout_width="fill_parent"
  507.  
  508. android:layout_height="wrap_content"
  509.  
  510. android:background="#ffffffff"
  511.  
  512. xmlns:android="http://schemas.android.com/apk/res/android"
  513.  
  514. android:orientation="horizontal"
  515.  
  516. >
  517.  
  518. <Button
  519.  
  520. id="@+id/widget66"
  521.  
  522. android:layout_width="wrap_content"
  523.  
  524. android:layout_height="wrap_content"
  525.  
  526. android:text="Button"
  527.  
  528. >
  529.  
  530. </Button>
  531.  
  532. </TableRow>
  533.  
  534. <TableRow
  535.  
  536. id="@+id/widget45"
  537.  
  538. android:layout_width="fill_parent"
  539.  
  540. android:layout_height="wrap_content"
  541.  
  542. android:background="#ffffffff"
  543.  
  544. xmlns:android="http://schemas.android.com/apk/res/android"
  545.  
  546. android:orientation="horizontal"
  547.  
  548. >
  549.  
  550. <EditText
  551.  
  552. id="@+id/widget68"
  553.  
  554. android:layout_width="wrap_content"
  555.  
  556. android:layout_height="wrap_content"
  557.  
  558. android:text="EditText"
  559.  
  560. >
  561.  
  562. </EditText>
  563.  
  564. <EditText
  565.  
  566. id="@+id/widget69"
  567.  
  568. android:layout_width="wrap_content"
  569.  
  570. android:layout_height="wrap_content"
  571.  
  572. android:text="EditText"
  573.  
  574. >
  575.  
  576. </EditText>
  577.  
  578. </TableRow>
  579.  
  580. <TableRow
  581.  
  582. id="@+id/widget49"
  583.  
  584. android:layout_width="fill_parent"
  585.  
  586. android:layout_height="wrap_content"
  587.  
  588. android:background="#ffffffff"
  589.  
  590. xmlns:android="http://schemas.android.com/apk/res/android"
  591.  
  592. android:orientation="horizontal"
  593.  
  594. >
  595.  
  596. <EditText
  597.  
  598. id="@+id/widget69"
  599.  
  600. android:layout_width="wrap_content"
  601.  
  602. android:layout_height="wrap_content"
  603.  
  604. android:text="EditText"
  605.  
  606. >
  607.  
  608. </EditText>
  609.  
  610. </TableRow>
  611.  
  612. <TableRow
  613.  
  614. id="@+id/widget48"
  615.  
  616. android:layout_width="fill_parent"
  617.  
  618. android:layout_height="wrap_content"
  619.  
  620. android:background="#ffffffff"
  621.  
  622. xmlns:android="http://schemas.android.com/apk/res/android"
  623.  
  624. android:orientation="horizontal"
  625.  
  626. >
  627.  
  628. <EditText
  629.  
  630. id="@+id/widget69"
  631.  
  632. android:layout_width="wrap_content"
  633.  
  634. android:layout_height="wrap_content"
  635.  
  636. android:text="EditText"
  637.  
  638. >
  639.  
  640. </EditText>
  641.  
  642. </TableRow>
  643.  
  644. <TableRow
  645.  
  646. id="@+id/widget47"
  647.  
  648. android:layout_width="fill_parent"
  649.  
  650. android:layout_height="wrap_content"
  651.  
  652. android:background="#ffffffff"
  653.  
  654. xmlns:android="http://schemas.android.com/apk/res/android"
  655.  
  656. android:orientation="horizontal"
  657.  
  658. >
  659.  
  660. <EditText
  661.  
  662. id="@+id/widget69"
  663.  
  664. android:layout_width="wrap_content"
  665.  
  666. android:layout_height="wrap_content"
  667.  
  668. android:text="EditText"
  669.  
  670. >
  671.  
  672. </EditText>
  673.  
  674. </TableRow>
  675.  
  676. <TableRow
  677.  
  678. id="@+id/widget50"
  679.  
  680. android:layout_width="fill_parent"
  681.  
  682. android:layout_height="wrap_content"
  683.  
  684. android:background="#ffffffff"
  685.  
  686. xmlns:android="http://schemas.android.com/apk/res/android"
  687.  
  688. android:orientation="horizontal"
  689.  
  690. >
  691.  
  692. </TableRow>
  693.  
  694. <TableRow
  695.  
  696. id="@+id/widget46"
  697.  
  698. android:layout_width="fill_parent"
  699.  
  700. android:layout_height="wrap_content"
  701.  
  702. android:background="#ffffffff"
  703.  
  704. xmlns:android="http://schemas.android.com/apk/res/android"
  705.  
  706. android:orientation="horizontal"
  707.  
  708. >
  709.  
  710. </TableRow>
  711.  
  712. </TableLayout>
  713.  
  714.  
  715.  
  716.  
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


Does anyone know the solution???
Please help me out

Regards
Shimul
Shimugool
User avatar
raquibulbari
Developer
Developer
 
Posts: 25
Joined: Sun Dec 16, 2007 6:31 am
Location: dhaka,bangladesh

Top

Postby plusminus » Tue Jan 29, 2008 2:13 pm

Hello shimugol,

wrapping a ScrollView around should do the job:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  2.  
  3.    android:layout_width="fill_parent"
  4.  
  5.    android:layout_height="wrap_content"
  6.  
  7.    android:scrollbars="none">
  8.  
  9.  
  10.  
  11.    <!-- your views here... -->
  12.  
  13.  
  14.  
  15. </ScrollView>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


Let us know if it helped you :)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby raquibulbari » Tue Jan 29, 2008 2:20 pm

thanks plusminus,
It worked perfectly :)
Shimugool
User avatar
raquibulbari
Developer
Developer
 
Posts: 25
Joined: Sun Dec 16, 2007 6:31 am
Location: dhaka,bangladesh

Postby NithinG » Fri Feb 29, 2008 5:58 am

Hello plus minus

If i need to restrict the display of items in the screen what i can do?? that means i need , say 20 buttons in one screen and i need to apply scrolling also...
NithinG
Developer
Developer
 
Posts: 36
Joined: Wed Feb 27, 2008 6:24 am

Postby plusminus » Fri Feb 29, 2008 4:04 pm

Hello Nithin,

to make it invisible, but still use its Layout space.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. .setVisibility(View.INVISIBLE);
Parsed in 0.035 seconds, using GeSHi 1.0.8.4

or as if it was not there at all:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. .setVisibility(View.GONE);
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby NithinG » Mon Mar 10, 2008 11:54 am

Hi plusminus,


If i need to apply scrollbars other than giving it in res/layout what i show do... that is giving it in the onCreate () function.


Thanks and regards,

NithinG
NithinG
Developer
Developer
 
Posts: 36
Joined: Wed Feb 27, 2008 6:24 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Alexa [Bot], Google [Bot], MSNbot Media and 18 guests