in Education by
I have a relative layout that has an ImageView and and a textview aligned to right of the ImageView. I have a class that inflates this relative layout and adds in itself (as if it is that layout). Initially textview's visiblity is set to GONE, hence the size of the view is just that of the ImageView. Now, when the view receives focus, I set the visibility of textview to VISIBLE and set an animation to incrementally resize the view from imageView's width to (approximately)imageview+textview width (I am actually giving hard coded value in the program). My question is, how can i determine the total width of the layout after i have enabled/diabled the visibility of the textview(since textview's width can be variable), so that i can specify that value to the animation as the final endpoint? I had like to find this out right after i set the visiblity because if there is a delay in enabling the visiblity and starting the animation, the output is like the view with complete width (imageview+textview) is displayed first, then goes back to imageview size(start of animation), and then goes on to imageview+textview size(end of animation). If these is no way to find it out at that time, then can anyone please suggesst me to manually calculate what the final size could be? ----EDIT---- For the effect I wanted to achieve, there didn't seem to be any way. Final dimension of a view can be computed only after layout for that view is done by Android. The final dimension cannot be computed right after you enable the visiblity of a child view Hence for my solution, I kept the parent layout (Relative layout) set to fill_parent for the width, had another child layout (background) whose size I could control through program, and then on top of this I have my imageView (Parent Left aligned) + textView (right of imageView, fill_parent). So when the view is created for the first time, parent layout is always fill_parent, background layout has size of the imageview only and set textview's visiblity to invisible. And when a text is added to the text view, few milliseconds later (Using countdowntimer), I fetched the final dimension, set the animation to scale the size from imageView's width to imageView+textView width, and after end of animation set the visiblity of text view to visible. Am not sure if my solution is the best but it seems to work properly without any glitches. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
If I understood your question right, using getWidth() and getHeight() in the view you want will return the dimensions you seek.

Related questions

0 votes
    I have a relative layout that has an ImageView and and a textview aligned to right of the ImageView. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    I have a relative layout that has an ImageView and and a textview aligned to right of the ImageView. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    I have a screen that has textviews and edittexts. I am trying to edittexts equal width. But they look ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 27, 2022 in Education by JackTerrance
0 votes
    Here some snippet of my code. when first time RecyclerView create I have to used recyclerView.scrollToPosition( ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    After I added some .png files into my Project Workspace drawable folder I refreshed my drawable folders in ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    A male plays an important role in determining the sex of a child give reason Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    I have a problem with table-layout:fixed and width of inner columns if their content wider than column. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Aug 1, 2022 in Education by JackTerrance
0 votes
    I've got a menu with multiple child elements, the problem I'm having is that the child menu is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 14, 2022 in Education by JackTerrance
0 votes
    I've got a menu with multiple child elements, the problem I'm having is that the child menu is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 30, 2022 in Education by JackTerrance
0 votes
    I've got a menu with multiple child elements, the problem I'm having is that the child menu is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 23, 2022 in Education by JackTerrance
0 votes
    I'm looking at making an custom Android object Serializable. Should be simple I just cannot find a easy ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Aug 1, 2022 in Education by JackTerrance
0 votes
    I've made a fresh eclipse reinstall + Android SDK v4.0. I am trying to create a new 4.0 AVD ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 30, 2022 in Education by JackTerrance
0 votes
    I'm trying to execute the following command: arp -a and I would like to redirect the output to a ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 26, 2022 in Education by JackTerrance
0 votes
    I have a fragment with a view and an options menu: public class OfferingsFragment extends Fragment { public ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I've noticed on Marshmallow (e.g. Nexus 6P) and also on some more recently updated Lollipop phones ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
...