In android app, I have display the number of buttons in number of rows in GridView using adapter, If i click the button in first row right corner automatically the second row buttons are moved to first row and hide the first row buttons by second row buttons. i need to fix the solution for, the button is not move.
Anyone can give idea to fix the solution for this?
1. Use fixed size Buttons.
2. The professional way to handle it, is usingIcons Images.
In GridView display the buttons inside the EditText and and set the background color as white for EditText, Now the buttons are not moving when click the button in first row on the GridView.
Related
I'm using some checkboxes that are inside a cardView which is either inside a scrollView. Since checkBoxes contain a considerable text size option, my application is not very smooth because it is not able to scroll when I click in pieces of display that contain text from checkbox. Is there any option that allow to a checkBox only to be selected if I click on grid of checkBox and not in the text? I didn't find anything...
Thank you
I am developing an Android App where I have a TableLayout and each cell has an EditText in it. I want to navigate through the cells using four buttons. For example: Two buttons for up-down navigation (same column, different rows) and two buttons for left-right navigation (same row, different columns). Then I want to highlight the cell that has the focus at that moment (e.g. by changing the background color of that EditText).
I want to know if there is a way I can set the focus (for navigation) programmatically and get the index of the focused cell (for highlighting)? Thanks in advance.
You can use View.requestFocus() to force focus to a view. For the index, you can use a variable for each axis. For example, everytime the right button is pressed you can increase the value of your x-axis variable by 1. And decrease when the left button is pressed. You should initialize those axis variables correctly.
In my wizard page I am using gridlayout with 3 colums. The 3 column will have remove button. I am using add button for the composite. when i push add button it will add new row to the grid layout.
Now I am trying to add listener to remove button. When I push the remove button it should remove the row in which the remove button is pushed from the gridlayout and should resize the composite.
How to achieve this. And how to get the row index of the gridlayout?
To remove the controls completely you need to call dispose() on each control and then call layout() on the parent composite.
GridLayout does not make any information about the positions of the controls available so you can't really get a row index. It does sound like you might be better using a TableViewer to show a proper table.
I have a problem with TextView that has ScrollBar. I know that in order to create scrollbar on the textview, I need to enable this on the xml:
android:scrollbar="vertical"
and in the code.java, I set like this:
tvChapterDesc.setMovementMethod(new ScrollingMovementMethod())
Then, now user could scroll the TextView, if it is more than the defined number of lines. (say maxlines = 5).
However, I have a Button where if it is clicked, it is supposed to scrolled the textview to the top, can I do this? How? For example that the textview has 1000 lines, and there is a button "top". if user click button "top", it will be scrolled to the top immediately, so user can start reading to the beginning of the textview again. How to do that?
You should be able to use the scrollTo function on the textView.
I have created a custom calendar, in which i'm setting the color for a single grid when it is clicked. My requirement is to change the color to some other color on second click. I tried achieving this by placing a onclick listener inside another onclick listener. It worked but its very buggy. sometimes the 2nd color stays in the previous grid or sometimes it doesnt work and sometimes it 'll turn to second color when i click on a previously clicked grid.
My requirement is to change the color of a grid to color1 on 1st click and color2 on second click on same grid cell.
try using counter for onClick. and according to counter change the color of grid..
set initially 0, if clicked once set it to 1 change the color and if clicked again increase counter and change color again. don't use onclick inside onclick.
use index counter and in onClick listener update the counter and change the color.
you can go for
GestureDetector
you can find more of it here - Detecting Common Gestures
with this you can detect common gestures like touch, down, fling, single tap, double tap, long press scroll