Android :: RelativeLayout Fill_parent Unexpected Behavior In A ListView With Varying Row Heights

Apr 29, 2010

I'm currently working on a small update to a project and I'm having an issue with Relative_Layout and fill_parent in a list view. I'm trying to insert a divider between two sections in each row, much like the divider in the call log of the default dialer. I checked out the Android source code to see how they did it, but I encountered a problem when replicating their solution.

To start, here is my row item layout:

CODE:..........

The issue I'm facing is that each row has a thumbnail of varying height (ImageView01). If I set the RelativeLayout's layout_height property to fill_parent, the divider does not scale vertically to fill the row (it just remains a 1px dot). If I set layout_height to "?android:attr/listPreferredItemHeight", the divider fills the row, but the thumbnails shrink. I've done some debugging in the getView() method of the adapter, and it seems that the divider's height is not being set properly once the row has it's proper height.

Here is a portion of the getView() method:

CODE:.........

The rest of the method simply sets the appropriate text and images for the row.

Also, I create the inflater object in the adapter's constructor with: inflater = LayoutInflater.from(context);

Am I missing something essential? Or does fill_parent just not work with dynamic heights?

Android :: RelativeLayout fill_parent unexpected behavior in a ListView with varying row heights


Android : VideoView Added To A Linear Layout With Parameteres FILL_PARENT FILL_PARENT

Jul 23, 2010

Consider a VideoView added to a Linear Layout with parameteres FILL_PARENT, FILL_PARENT.

The Linear Layout gets added to the root layout which is a Relative Layout, with parameters WRAP_CONTENT, WRAP_CONTENT.

Which parameters take precedence here?

View 1 Replies View Related

Android :: Fill_parent With ListView Cells - Single TextView Span One To Two Lines

Feb 12, 2009

I am having this issue where I am trying to have a single TextView span one to two lines, fill the cell completely (so you can also click edges of the cell and it will trigger) and center-align.

This is the layout for the cell:

CODE:...

However cells seems to be filled correctly ONLY if it happens to wrap around and end up spanning two lines of text. It shows center-aligned and you can click anywhere in the cell to trigger the click. The cells that do not span multiple lines of text are left-aligned and trigger (highlight) only if you click where the text is. There is a "numb" area which does not react to clicks inside the cell if the text is short.

View 6 Replies View Related

Android :: Getting Right Highlighting Behavior In ListView

Sep 20, 2010

I have a ListView set up in single-choice mode like this:

<ListView android:id="@id/android:list"android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#ff444444" android:layout_weight="1"
android:drawSelectorOnTop="false" android:choiceMode="singleChoice" android:scrollbars="vertical"
android:headerDividersEnabled="true"/>

When I press my finger on a choice, the selection changes from white text on light gray to black text on orange. But as soon as I lift my finger, the selection reverts to the original state. I'd like that chosen row to remain in the black-text-on-orange mode when I lift my finger so that the user knows what was selected in the list (my onClickListener has captured the selected row, of course). Is there a way I can tell the ListView that I want this behavior or something similar so the user knows what item has been selected?

View 6 Replies View Related

Android :: AddHeaderView Changes Behavior On ListView / Way To Fix?

Jul 10, 2010

I got two kind of lists on 4 different views. All lists are clickable and starts an activity to read the clicked record. One is just a listview populated from the DB and works fine. The second is also a listview populated from a DB but has a addHeaderView. This makes the list forget where it was when you return from the listview's intent. If I remove the addHeaderView(); it works fine. Why does AddHeaderView changes or even malfunctions ListView's behavior?

View 2 Replies View Related

Android :: Reverse ListView Scrolling Behavior?

Sep 16, 2010

I have been trying now for a few hours to reverse the scrolling of behavior of the ListView. Essentially when scrolling down with my finger I want the list to scroll up!

View 1 Replies View Related

Android :: ListView Scrolling Behavior And Performance

Feb 4, 2010

I have a listview showing contacts.

When I'm scrolling the list the scroll works pretty smooth however when/if I'm trying to continue the scroll in the middle of the last scrolling the scroll just stops and sometimes the item I clicked on is selected (I have registered an OnClickListener to the item view).

I would like to get smooth scrolling just as in the device native contact list.

My implementation builds each contact a view containing: 1. Big picture for the contact image. 2. Small picture for the type of the contact. 3. TextView with the Contact name 4. TextView with some extra text about that contact.

My current layout for every item looks like:

CODE:........................

I've tried changing the LinearLayouts to relative ones but saw no improvement in performance.

I've created my own "Selector" in code (to eliminate the time it takes to load the resource) so that odd rows will have different background color. The code looks like:

CODE:........

View 3 Replies View Related

Android :: Change Default OnListItemClick Behavior Of ListView

Jun 18, 2010

Is there any way i can make my listactivity (rather listview) highlight the List Item when it is clicked (pressed) upon? (...and remain highlighted) The default behavior, simply highlights the item for a moment, and it gradually fades to black... Currently, the highlighting only happens when we use the DPad... It'd be ideal if atleast one list item is "highlighted" at all times. Worst case scenario, i may have to keep track of the "last clicked item" (by default the first) and change its background or something...but i was hoping there was an easier way...

View 1 Replies View Related

Android :: ListView - Index And Position Behavior Upon Restart()

May 19, 2010

I am using a ListView with an ArrayAdapter that holds objects. When I select an item, I am capturing the position and index of the selected item. If I scroll down prior to selection, the position and index represent the location of the item in the list. Selecting that items takes me to another activity. When I use the back button to return to the list, it seems that the ListView gets a new position and index for the visible items.

As a result, I can't figure out how to reference the selected item during the restart() of the ListView Activity. I have tried to capture position and index, but as I've said, they change upon returning to the Activity.

Is my understanding of the ListView "redraw" correct? Does it renumber my items based on what's visible? -When in the life cycle is getView() called? Is there a way to force an update to the ListView so that my captured index still points to the same object?

View 1 Replies View Related

Android :: Table Row Heights Getting Blown Out

Nov 11, 2010

I have a TableLayout with 3 TableRows, each TableRow has 3 ImageViews. Each ImageView has fitCenter for Scale type, and a weight and width per this stackoverflow answer. Now all the images scale to fit into the row, but each row is way taller then it needs to be. Here's an excerpt of the xml:

<TableLayout android:id="@+id/TableLayout01"
android:layout_height="wrap_content"
android:padding="10dip"
android:stretchColumns="0,1,2"
android:shrinkColumns="0,1,2"
android:layout_weight="1"
android:layout_width="wrap_content">
<TableRow android:id="@+id/TableRow01".............

View 1 Replies View Related

Android :: Matching TextView Heights

Sep 20, 2010

I have two vertical TableLayouts containing rows of TextViews separated by some graphics. Something like this:

R-L Graphics R-R R-L R-R R-L R-R R-L R-R R-L R-R

The R-R TextViews have a fixed width, which means they grow vertically when the text is longer than will fit in the width. The text is set at runtime so this height is not known in advance. I want the height of the R-L rows to exactly match the height of the R-R rows with the R-R rows being the reference source for the height. Once I do a TextView.setText and a TextView.setWidth on the R-R TextViews, the height of those TextViews should be determined. Then I can do a TextView.setMinHeight on the R-L TextViews. But I'm having trouble getting the height value from the R-R TextViews. The TextView.getHeight method returns zero.

View 5 Replies View Related

Android :: Custom ROMs Varying Configurations

Sep 18, 2009

I just wanted to quickly bring up a topic that I had noticed lately. This comes to my attention for two reasons, firstly someone had posted that he had a user that reported a vague error message like "deleted all my pics", and the dev's were not able to reproduce it. Secondly, I myself have seen bug reports that really may not be relevant to my application. I had recommended to that first dev to just ignore the error for now since there was not enough info to reproduce it, and also for a second reason, there is no way to know what the user is truly running. For example, I've had a few bug reports, where a user says of my app "Doesn't work on HTC hero", but then another user will post "Works fine on Hero". I also had found a posting on the internet in a forum where a user had tried to use some of my software on a custom ROM, and he was having problems.

I guess the issue I'm bringing up here is that with the android market being somewhat "limited" in functionality, it makes it very hard on us developers to handle any customer issues such as bugs, etc. Especially since they could be using a custom ROM, or have ROOT access which also may even be affecting the software. My point is that developing for android in a professional manner is really not an easy task, and possibly it's just starting to be worth it (with market 1.6 at least there are some improvements) to develop paid apps. Basically Google needs to work harder though to improve this situation - and if users expect better apps (there are lots of complaints about the market being full of junk) then they need a way to report issues better, etc. And really it's not even up to a dev to try to match up with a custom ROM, technically it's not supported! (It's up to the dev of course if they want to investigate and try to support it).

What seems is going to happen is android is not only going to have multiple configs (which fortunately for us seems that the market will help filter them out if you app does not support them), but also we never can really know what is on a user's system. They may have some custom stuff, and they see a bug, but it could really not be our bug, but rather, in the system itself. This is why I still recommend that bug reports have to be weighed carefully as to whether they may really be a problem or not. It's an investment in time and while makers of free apps no doubt may not mind, those of us who develop paid apps don't want to multiply our costs by going down blank pathways.

I don't think I see any resolution to the situation in the near future, but I just wanted to make it clear that if a user reports a bug in their comments and gives you one star, it's not the end of the world. If you can reproduce it quickly and fix it, then that is great. But if not, move on - there is no way you can know exactly what they are talking about. I think some devs get too anxious about that one bad report. There is no way we are going to avoid that report! Because they may be using an untested ROM or such anyway, and it may not be worth your time to look at it in the long run. I've had few low stars here and there as well, and trust me, just keep improving your app and you will rise back up. As devs we need to encourage one another and I just want to try and help devs not get anxious about things that are really beyond their control.

View 2 Replies View Related

Android : Placing An Array Of Buttons Of Varying Length On The Layout

May 1, 2009

I want to populate my UI with dynamic buttons at runtime. I am trying to invoke a feed from the net and based on the results (which are URLs pointing to image resources), i need to create buttons on the layout with their background set as images retrieved from URLs. I have an array of buttons which get instantiated based on the number of results returned. I was wondering whats the best way to do it - as writing them on the main.xml is not feasible.

View 2 Replies View Related

Sony Ericsson Xperia X8 :: When Use App Screen Brightness Keeps Varying On Its Own

Oct 27, 2010

The brightness of my sony xpreia x8 keeps varying on its own, even while i am using any application. Any idea on why this may be happening?

View 2 Replies View Related

Android :: Set The Widgets Width To Fill_parent?

Apr 29, 2009

Ive read the docu for home screen widgets but i couldn't find a possiblity to set the widgets width to fill_parent, instead i must use dip. The widget should fill the screen width regardless of the screen orientation. Somebody have a idea?

It is posssible to set a animation to a home screen widget? Something like,if special button of the widget is clicked, the widget shows a view that breaks out of the widgets borders which are defined in the home screen widget meta-data file?

View 3 Replies View Related

Android :: Simple LinearLayout And Fill_parent?

Dec 24, 2009

I'm sure I am missing something simple...

Background:

I am new to android and UI design, and I just wanted to play around with layouts. Right now I want to stack a checkbox on top of text label. I am using the following xml layout which works fine:

CODE:................

My Tests (just to get a feel for how things works):

Scenario 1) When I set the CheckBox's layout_height to "fill_parent", the CheckBox takes up the whole screen and is aligned center (i.e. - the TextView disappears).

Scenario 2) If I instead set the TextView's layout_height to "fill_parent", the CheckBox does NOT disappear. In fact, nothing disappears, and the layout looks the same as the above xml where everything is pushed to the top-left.

The Question (and comments): How come Scenario 1 works the way it works?

This behavior seems inconsistent to me. I thought that fill_parent is only supposed to let the element fill up whatever space is available in the parent. So to me, it seems that the TextView should get whatever space it needs (since it is wrap_content), but the CheckBox should take up the rest of the space (so the TextView would be forced to the bottom of the screen, but not invisible). In other words... Scenario 2 makes sense to me, but scenario 1 does not.

View 1 Replies View Related

Android :: Fill_parent For Each Child Widget?

Aug 30, 2009

I am using a HorizontalScrollView to contain and scroll 3 child widgets, each of which is either an ImageView or a custom widget. What I'd like to achieve is something like homescreen, where each child widget filling up the whole width of the display and the user is able to switch to the other widget by flickering horizontally. I am having a hard time figuring out what properties I should assign to each of the child widget in order to have them fill the parent container. I get it working if I hard coded the width for each child but I'd like them to be able to fit to any screen resolutions, as the current Android homescreen does.

Here is the xml (pseudo like)

HorizontalView -> LinearLayout -> children widgets

View 2 Replies View Related

Android :: Setting The Dimensions Of A Dialog - What Does Fill_parent Mean?

Nov 7, 2010

The Android Developer guidance on Creating a Custom Dialog specifies a layout that starts:

code:........

If I use this code I get a dialog that sits in the centre of the screen with about 40 pixels of the underlying view visible on each side.

What exactly does "fill_parent" mean (for the width and height)?

View 2 Replies View Related

Android :: Dialog Not Responding To Fill_parent Setting

Apr 26, 2010

I want my dialog box to fill the screen as I have seekbars set on fill parent, and so it makes this tiny dialog in the middle of the screen with tiny seekbars to go along with it.

View 2 Replies View Related

Android :: Fill_parent - List View Occupies Full Screen

Sep 30, 2010

This is my layout

CODE:......

When I run this the list view occupies full screen. What I want is list view to be full screen except button area without mentioning dp.

View 4 Replies View Related

Android :: Unexpected End Of Document Exception

Nov 21, 2010

I'm getting a "SAXParseException: Unexpected end of document" error when trying to parse an xml document on android. The document in question is from the google weather api, but it seems to throw the same error regardless of the xml file in question (as long as the xml is valid) so I suspect it's a problem with my approach, rather than the xml. This is being done as a learning exercise, so I've probably (hopefully) overlooked something obvious. I've run the xml through an online validator, and it comes back as being well formed. (Can't tell me if it's valid as I don't have a DTD, but I dont think I need the DTD to parse the xml). This is the code that I'm using to try and parse the file:

private void refreshForecast() URL url;
try { url = new URL( "http://192.168.1.66:8000/google4.xml");
URLConnection connection = url.openConnection();
HttpURLConnection httpConnection = (HttpURLConnection)connection;
int responseCode = httpConnection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
InputStream in = httpConnection.getInputStream();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
// falls over here parsing the xml.Document dom = db.parse(in);
} } catch (ManyExceptions e) { ....
} A cutdown version of the xml that produces the error is:

<?xml version="1.0"?>
<xml_api_reply version="1">
<weather>
<forecast_information>
<city>Hamilton</city>
</forecast_information>
</weather>
</xml_api_reply>

The stacktrace is:
11-20 06:17:24.416: WARN/System.err(406): org.xml.sax.SAXParseException: Unexpected end of document
11-20 06:17:24.416: WARN/System.err(406): at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:131)
11-20 06:17:24.416: WARN/System.err(406): at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:110)
11-20 06:17:24.426: WARN/System.err(406): at com.dave.nzweather.WeatherApp.refreshForecast(WeatherApp.java:159)
11-20 06:17:24.426: WARN/System.err(406): at com.dave.nzweather.WeatherApp.onCreate(WeatherApp.java:100)
11-20 06:17:24.426: WARN/System.err(406): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-20 06:17:24.438: WARN/System.err(406): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-20 06:17:24.438: WARN/System.err(406): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-20 06:17:24.446: WARN/System.err(406): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-20 06:17:24.446: WARN/System.err(406): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-20 06:17:24.456: WARN/System.err(406): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 06:17:24.456: WARN/System.err(406): at android.os.Looper.loop(Looper.java:123)
11-20 06:17:24.456: WARN/System.err(406): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-20 06:17:24.466: WARN/System.err(406): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 06:17:24.466: WARN/System.err(406): at java.lang.reflect.Method.invoke(Method.java:521)
11-20 06:17:24.466: WARN/System.err(406): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-20 06:17:24.476: WARN/System.err(406): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-20 06:17:24.476: WARN/System.err(406): at dalvik.system.NativeStart.main(Native Method)
11-20 06:17:24.486: WARN/ROGER(406): org.xml.sax.SAXParseException: Unexpected end of document

In the interest of brevity, I've not included the original xml, but it's just the standard weather xml from googles feed. I've also tried a few completely different xml files, (including the sample from http://www.ibm.com/developerworks/xml/library/x-android/) and they all give the same error. (They also all validate as well formed when I run them through an online xml validator). This makes me think that it's not a problem with the xml, but rather with how I'm trying to feed it into the parser.

View 2 Replies View Related

Android :: Checkbox In List Being Checked Unexpected

Feb 16, 2010

I have list of checkboxes in list binded by Custom simpleCurserAdapter. in my Custom simpleCurserAdapter ive override the newview and binview with my modifications. ive managed somehow to do multichoice.. wierd thing after i delete any item from my list , the first item's checkbox is being checked all of a sudden.. how does that happen? how can i solve it?

code: my curser SimpleCursorAdapter class:

CODE:......

I couldnt find another way of doing this, but this is how i set listeners to my checkboxses

CODE:.....

Now this is code part from the ListActivity class which desbribes the button which deleting the checked Box items

CODE:......................

View 3 Replies View Related

Android :: SensorManager.registerListener Gives Unexpected Results

Nov 30, 2009

I'm registering a sensor listener with this line of code.

mSensorManager.registerListener(this,mSensorManager.getDefaultSensor (Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_FASTEST);

The rate is set to SENSOR_DELAY_FASTEST with the expectation that I would receive events roughly every 20-30ms. It turns out that I receive events only every 200-220ms (just now, my event code simply logcats the system time).

No matter which rate I use, SENSOR_DELAY_NORMAL, SENSOR_DELAY_UI, SENSOR_DELAY_GAME, or SENSOR_DELAY_FASTEST, I get the same result?

View 15 Replies View Related

Android :: Astrid Warning - Prevent Unexpected Erase?

Feb 12, 2010

Got a Samsung Moment a couple of weeks ago. Last night starting using Astrid (Task/ToDo app), which came pre-installed on my phone. When I launched Astrid for the first time, I got a warning message -- something about making sure Sprint Update or Sprint Updater doesn't kill Astrid, or ruin it, or something. Clearly, I didn't understand the message. But I clicked "Okay" anyway, and started using Astrid. But I'm worried that a Sprint Update could erase all my Astrid data -- my To Do's. I'm reluctant to create many Astrid tasks until I know how to prevent them from being unexpectedly erased. My questions: Can anyone explain the situation to me? (e.g., I have no idea who/when/how/where/what Sprint updates). Can anyone explain what I need to do to prevent the catastrophe about which Astrid was warning me?

View 1 Replies View Related

Android :: How To Debug Unexpected Exceptions (source Not Found)

Feb 9, 2010

I am pretty new to Android, the thing that bugs me the most about the IDE is that I am not able to get any information about an unexpected exception when it gets thrown, I can put a try catch block around identified code that generates it, but in many cases it takes time to find the line of code that generates the exception. is there any other way I can get the exception information? in JDT when an unexpected exception is thrown the call stack displays the exception class name. but in ADT this doesn't work.

View 13 Replies View Related

Android :: Unexpected Visual Element In Simple Tab Layout

Jun 19, 2010

The screen shot below is of a simplified version of the application from the Tab Layout tutorial. You can see a black horizontal line below the tabs. Why is it there and how can I remove it?

View 2 Replies View Related

Android :: Handle Unexpected Internet Disconnect While Downloading Data

Mar 31, 2010

I have here a function that downloads data from a remote server to file. I am still not confident with my code. My question is, what if while reading the stream and saving the data to a file and suddenly I was disconnected in the internet, will these catch exceptions below can really catch that kind of incident? If not, can you suggest how to handle this kind of incident?

I call this function in a thread so that the UI won't be blocked.

CODE:...................

View 1 Replies View Related

Android : Child Activity Exit By Unexpected Exception - OnActivityResult - Is Not Called

Jun 23, 2010

I have faced with issue about startActivityForResult() and onActivityResult(). If child activity started by the startActivityForResult() exit by unexpected exception the onActivityResult() is not called and I have no any ideas how can I handle this to get application working in a fail-safe manner ?

When my code runs child activity with startActivityForResult() it awaits until onActivityResult() will be invoked to get working further, but onActivityResult() is not calling and my code is "hang- up" (logically).

So the question is how can I handle all possible ways the child activity is finished (normally and by unexpected exception) to get fail-safe code ?

I have check the documentation for this issue but have found nothing relating issue.

View 4 Replies View Related

Android :: ListActivity - When Using With RelativeLayout

May 16, 2010

I've been progressively expanding my UI, and I want to add a ListView in the middle of my UI. When I add it and change the activity to extend a ListActivity instead of just an Activity, I'm getting a Force Close. Using 1.5. Does a ListView not work embedded in a RelativeLayout?

CODE:.........

XML looks like this:

CODE:..........

And the listrow.xml:

CODE:.............

View 2 Replies View Related

Android :: Add Spacing In RelativeLayout?

May 6, 2010

I have a Relative Layout.
Which has 2 buttons, side by side and it is right-aligned.

So this is my layout xml file. My question is there are no spacing between the right-most button and the right border of the RelativeLayout and between the 2 buttons. How can I add that? I play with android:paddingRight, but nothing helps. code...

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved