Android :: Dynamically Changing Linearlayout Width / Height
I am trying to change linear layout or any other widget width or height dynamically but throwing exception.so how can I change the dimensions dynamically.....
View Complete Thread with Replies
Related Forum Messages:
Android :: Get Height Of A Linearlayout
I'd like to get the height of a linearlayout. I found more information in this answer
View.getWidth()/View.getHeight() won't give you a meaningful answer until the view has been measured.
How will I know that view has been measured? Is there some event for it?
Solution for me is to get layout's height in overriden onWindowFocusChanged()
Android :: Proportional Width Of Elements In LinearLayout
I have a horizontal LinearLayout and in it I have EditText and Spinner elements. Which attributes I need to adjust so I would get proportional widths: I want EditText to take 3/5 and Spinner - 2/5 of all available width?
My code looks like this:
I tried setting android:layout_weight, but somehow it does not look "stable" enough for me - when EditText has no text - everything looks fine, but as soon as I start entering text into it - it starts expanding and Spinner shrinking accordingly...
Android :: Setting Width Of Textview In A LinearLayout
I am using a header for a Listview. ListView header has three columns. Say a,b,c. I am using two LinearLayouts to design ListView header as shown below:
Now i want to fix the width of columns a, b, c respectively. How to set width of these columns ? Again, is it a good practise to use LinearLayout for this ? Please Advise.
Android :: Adding Textview To Linearlayout Dynamically?
I try to add a texview to linearlayout dinamiclly such as in the following code, but it doesn't appear when i run the application ?
TextView tv=new TextView(this);
Android :: Getting Width And Height Of Device Programatically For QVGA Devices?
I want to get the width and height of my device to know what type device it is ie QVGA, HVGA ,WVGA.. Also i need to adjust some layouts according to width and height of the screen.
I tried following methods but its not working.
All these methods return wrong width and height for the 240x320 devices namely Samsung Europa and Alcatel which i have. Width = 320 Height = 240.. This is wierd as some of the critical functionality is getting hampered .. I think this is really a basic thing which shd be correctly provided. Please help me with this issue .
Android :: How To Dynamically Set Textview Height
In my application I need to set dynamic text to my textview so I want it to get resized dynamically. I have set:
And from java code I am setting text of the textview at runtime.My textview height is not going beyond 1 line and the text is getting cut. Can anybody please help?
Android :: Dynamically Set EditText Height?
I want to simply set the height of an EditText component to be 50% of the user's screen height.
I'm creating the initial layout from an xml file (main.xml), loaded in the Activity's onCreate(Bundle). From the xml configuration, I understand how to set the EditText height to a literal value, e.g., android:layout_height="150dip", and from the onCreate(Bundle), I understand that I can call setHeight(int) on the EditText component, but the call to setHeight(int) appears to be ignored, and if I don't have the layout_height setting out of the xml, then I get an exception when my app is starting, complaining that the height value is required (and the app dies).
Is there a way to set the height from the xml based on the user's screen height? In other words, within the xml, is it possible to retrieve the user's screen height and use it to calculate a value for a component?
(I'm placing the EditText in a LinearLayout with vertical orientation.)
Android :: Control Frame Height And Width Of Captured Video : SetVideoSize() Does Not Work
On a Nexus One (for example), the camera application is able to capture H.264 video at 720x480 (the "High" quality setting). However, when using the MediaRecorder API, it always seems to capture at a fixed frame size of 320x240.
I would expect the setVideoSize() method to control the frame size (as in the prepare fragment below), but it appears to have no effect (using Froyo 2.2 Android SDK).code...
Discussions on the android developers list seem to indicate this is a long standing issue. Can anyone advise how the frame size can be controlled, or if it is possible at all with the current API?
Android :: Adjust Height Of Group Headers In An ExpandableListView Dynamically?
I have an ExpandableListView (ELV) with the groups having LinearLayout. I have set the height of the group to some value (38dip in this case, equivalent to two lines of text). If the group heading is long and would take more than 2 lines, it is not shown properly in the ELV item - some part of the view gets scrolled. On the other hand, if I change android:layout_height to "wrap_content" in the LinearLayout, the groups always show all the lines. But the line widths are variable, i.e., short titles show up with only 1 line and long titles show up with 2, 3 or 4 lines. That looks ugly. I would like to implement the height to be something like max("38dip", "wrap_content"). Is there a way to do this?
Even programmatically, I do not seem to be getting the actual height of the group if I set android:layout_height to "wrap_content". Any suggestions there?
Android : Changing Width Of SeekBar
How to change width of a SeekBar? Below is a TableRow with two items in it, a Button and a SeekBar. How can the SeekBar be made to extend its right side to fill in the remaining width of the TableRow? Currently I have only been able to control the SeekBar width by setting it's android:layout_width attribute. Is there a way to have the LayoutManager do this automatically or can it be done programmatically? It is especially noticeable when the Orientation is changed from vertical to horizontal and the SeekBar remain stuck way over there on the left with available real estate on its right.
Android :: Dynamically Changing Views
I'm trying to learn how to build apps for Android. The first simple app, which will become a component of a bigger app I hope to build, is to have a button on the screen where, when tapped, it adds something new to the view. For instance: Imagine a layout that only has a button:
When that button is pressed, the view gets a new row added to it: