Android: borders messed up on clickable view elements? - android

Hey folks. I have a strange problem with my EditView elements in an Android project I am working on. I make the view clickable in the xml file and put an action listener on it to launch a Uri. No problem there. What I'm finding though, is that the bottom of the view element disappears when the view is clickable. Below is a screenshot of what I mean. I added the bold/blue font to make the items stand out more, but it did that before adjusting the font as well.
Since I can't post an image here, I've linked to it below.
https://docs.google.com/leaf?id=0BxAyDSR7j2blZWYzYWViYjctM2E0Yi00NWFiLTllYmQtMTA3YWI3YTBhYmEw&hl=en

Turns out the problem is related to bolding the text. If I remove that, it does stop the problem. Looks like I need a better solution for pointing out clickable fields.

Related

Android Studio & Constraint Layout Editor Problems

I have watched numerous videos, including Google's own, and i'm really struggling with ConstraintLayout, it simply doesn't work for me, like it works in the online videos.
When I drop a textview onto the constraint layout editor, it jumps to the top right of the form. In the demo videos, it stays where it's dropped, and it's easy for those people to set up the relationships by dragging handles. For me, It's all up in the top right, and I can only get to 2 of the handles.
It gets worse if I then drop two more text views into the form, they are all now all the same size and all overlapped at the top. Whenever I use constraint layout, I end up tearing my hair out, and then giving up and going back to an older layout.
I really want to use constraintlayout, but clearly I am missing something really obvious here, but I can't figure out what.
Yes the drag and drop doesn't work well. For me I just use several steps to add a new view:
1. drag new view to the end of the view list window (not on the design view! design view will add unnecessary properties and is not clean)
2. select the new view, and name it! name is very important to constraint layout.
3. set the layout_constraint_xxx attributes from the property window
then it goes to the expected places.
Try disabling the experimental render engine and re enable it again

Ignore windowSoftInputMode for certain elements eg. Background Image

My question is, is there a way to get a certain view element to ignore the windowSoftInput setting, or to set a specific setting for one view element? (Any other solutions to my problem are also welcome)
Below are more details about my problem.
I have an Android activity with a background image set to the main FrameLayout. This layout contains a few other layouts, among others a brand logo on one side, and a scrollview with edittext boxes on the other side.
Using the windowSoftInput="adjustResize" works pretty well, but it distorts the background image. Using windowSoftInput="adjustPan" however pans the brand logo out of the screen and messes with the scrollview, and the keyboard blocks the edittext boxes.
So far, looking around the web and the docs I can't find a solution, or if this is even possible. Android layouts always seem to confuse me though..

An alternative to a list of SlidingDrawers

Hi I am developing an application that needs to display list of items. Clicking (or Tapping) on an item should display a description text of the item right below the item. I am talking about something like a vertical accordion.
I want them dynamically created (created in code rather than the XML). That part was completed with ease. I inflated multiple SlidingDrawer in a LinearLayout to accomplish it.
But the problem is only one SlidingDrawer is displayed in the activity. This was accomplished by giving fixed heights to SlidingDrawer. This approach will not hold as I mentioned above that the list of items is dynamically generated and also the area in the activity where the description of the item must come remains blank.
I am now looking for alternative views for accomplishing this. As I am a beginner in Android Development I cant find any that will work in android versions 2.3 and later.
You can always take a look at the SlidingMenu. The project can be found on GitHub. I guess you need to modify the behaviour a bit.

Android clickable panel UI

I am currently working on an Android app, I have completed all the 'hard stuff', such as getting my database working, and so on. Now I need to make the UI look decent.
I would like to make something that has a 'frame' layout that is clickable. You would click on a 'frame' to find out more information, a bit like the Amazon app.
If anyone has any ideas, tutorials or good links, I would be very grateful.
Thanks in advance.
Take a look at Gallery. It's built in to Android and does what I think you're looking for (at least, it describes the Amazon app's UI; since FrameLayout has a very explicit meaning in Android that is not at all what you're talking about, I ignored that part).
EDIT: A screenshot would have been helpful but I think you're actually talking about a simple list-like view.
Oh. That's either a ListView, or more likely just a vertical LinearLayout inside a ScrollView. I can tell you what I'd do: Each item in the LinearLayout would have a background set, with a width of match_parent and a height of wrap_content, using a 9patch with the right-pointing arrow inside it. I'd also define an identical but blue-highlighted version of the image for the pressed state and use a state drawable XML to let it know which to use. Then I'd just bind an onClick listener for each item I wanted to fire off a click action on.

Which Android control to use?

I'm taking my first steps in Android programming.
My application is to create entries in a database. For this task I have created a new Activity. All is fine - but I don't really like how it looks.
Currently, the emulator shows this:
I'd like to have something similar to the "New Contact" Activity:
Buttons at the bottom of the window, not directly below the other controls (I'll hopefully figure that out myself)
Buttons within a nice "box" like shown in the screenshot (what's the control hosting the buttons here?)
When soft-keyboard is displayed, the buttons should "move up". If there's not enough room, the entire area should be scrollable (I'll try and figure that out myself too)
Sample can be seen here:
Which control hosts the buttons in the above "New contact" screenshot? I'd like to use the same for my buttons.
One way to figure out what an existing activity does is to use hierarchyviewer and examine the activity's contents.
Another way to figure out what a native Android activity does is to look at the source code. In this case, it would appear that the buttons are inside of a horizontal LinearLayout with style="#android:style/ButtonBar" to give the silver sheen. That style, in turn, uses #android:drawable/bottom_bar as its background. That image can be found in your SDK installation -- go to the platform directory of your choice, then data/res/drawable-hdpi and data/res/drawable-mdpi for the two versions.
The contacts layout looks like a ListView sitting on top of some sort of RelativeLayout or LinearLayout housing the buttons. The silver background may simply have been set using android:background on the Layout itself (layouts are views).
I found that the commonsware books are excellent resources for getting started and have good examples for this type of layout.
Hey, this is a little late, and I know you've already got the silver bar you wanted, which is all good, but I've stumbled upon a really good guide on controlling the soft keyboard for best user experience. It covers, among other things, how to make the visible area resize to fit the button bar in the view while typing, which is done by specifying the activity in the manifest file like so:
<activity android:name=".MyActivity" android:windowSoftInputMode="resize" />
I really recommend reading it, it covers a lot more helpful stuff than just that. Hope that helps; I couldn't see that anyone else has answered that particular part of your question.
You can put them in LinearLayout and assign weight of 1 to each of the buttons.
Also if you own dev phone / or want to see UI of the application in emulator - there is a very cool tool call hierarchyviewer
http://developer.android.com/guide/developing/tools/hierarchy-viewer.html
and you can see how UI of app you like has been laydown.

Categories

Resources