Drawing indicator between activated list row and main fragment - android

I am trying to emulate the UI used by the gmail tablet app. When an item in the list view to the left is in an "activated" state I wish to draw an arrow indicator linking the list row to the main content fragment on the right-hand side. The "arrow" I am referring to is circled in this image:
Gmail App Screenshot
I have achieved this by using background drawables for the list rows which is satisfactory; however, I want to make use of a divider to separate the list and the main content area. So my question is how could I achieve this without using a background drawable? I tried having the arrow indicator as a child of the list row and attempting to draw it 1 pixel outside the row to cover the divider but this did not work.
Any help is appreciated, thanks.

Your question is similar to these:
Shadow Separator Between Android Fragments
ListView row marker ala GMail
Reading their answers it seems the easiest way to do what you want is using background 9-patch drawables.
In fact, the Gmail app uses 9-patch PNGs to achieve this effect. You can see it for yourslef if you take a look to the PNG files inside Gmail APK's res/drawable-hdpi folder (you will need a tool like AirDroid to obtain the APK from your device).

Related

Using certain elements of an image in the [ImageView] widget as buttons

So lets say I have a segmented circle image asset inside an 'ImageView' widget, and I want to use each segment of that circle as a clickable surface to bring up a fragment with an image and some info.
Is there any way to build transparent arrangeable borders that I can use to do this with?
I'm using android studio with the default NavigationDrawer activity if that helps.
Maybe adding some ImageViews with transparent images on top of each section and making them clickable? That's how I'd do it. Of course this won't cover perfectly the area but it may work for what you need it.
So I found this. In case it can be of help to anyone else:
https://github.com/anupcowkur/Android-Wheel-Menu

Android: Locating basic drawable

How do you reference the drawable for the 'home as up' icon?
I am trying to add this drawable in a custom XML layout. I do not want to change the icon displayed in the ActionBar, but rather use the drawable for something completely different
Tips on how to go about finding it without searching through every item are appreciated!
This image is named as ic_ab_back_holo_dark_am.png
or ic_ab_back_holo_light_am.png
These images are at sdk/platforms/version/data/res/drawable-versions where version must be 11 or later.
like
sdk/platforms/android-19/data/res/drawable-hdpi. You can find all images from there with there actual name.

Wrap content inside box

How can I wrap the content inside a box? Just like twitter.
Check how is Twitter and how is mine:
http://img17.imageshack.us/img17/8241/stackoverflow.png
To get the effect your trying to go far, you're going to have to use a 9patch png as your background image for your ListView and set padding on your ListView to match the size of your border on your 9patch.
The 9patch should look exactly like the background as it shows in the Twitter example.
You can learn more about 9patches here.
It's an optical illusion. You really want to create three 9-patches - top item, middle item, bottom item. Then dynamically set the background drawable for each item based on its position in the list. Just make sure your borders line up properly between the drawables and you should be fine.

Android ListView being replaced by a drawable or showing incorrect background

I am seeing some very weird behavior with a set of ListViews that I have in a single Activity.
I have 5 ListViews that make up a custom control that acts like a lock combination on a briefcase. All 5 of these have transparent backgrounds and they are overlaid on top of their background using a RelativeLayout.
Every once and a while, all 5 of the ListView backgrounds will be filled with a drawable png image that I have on the same Activity. When this image shows up, there are no elements in the ListViews like their should be. I usually clean the project and push it back onto the phone which fixes the problem. However, I am trying to figure out if the issue will happen whether or not it worked out of the box.
I am not sure if the ListView is being entirely replaced by the drawable. I DO know that there are never any elements in the ListViews when the issue occurs.
What would cause the issue of an image resource showing up as the ListView, instead of the ListView and their contents?
Update:
I thought this could be resolved by cleaning/rebuilding the project, however I'm now finding out that this problem occurs during run-time.
After replace an image on the home screen, I found that the image being incorrectly loaded into the ListView is actually from another Activity.
If I used my own transparent #00000000 color for the android:divider of the ListView, I would see this issue.
The fix was to use #android:color/transparent instead, and the behavior corrected itself.
If the image is the background of a parent element in your layout XML, then it will show up when your lists are empty.
Alternatively, does your ListView specify an empty image to be displayed when there are no elements in the list?

Android: How to use existing graphic elements

I would like to create a user interface which would contain network indication icons (3G, WiFi...) and I would like to use existing graphic elements which are displayed in notification bar.
Does anyone know how to get these existing elements and use it in custom layout?
I guess these icons are all ImageView elements and I am wondering whether it is possible to retrieve them with findViewById() method.
They are drawables in android.R.drawable. There is a list of avaiable drawables for 1.0 at drawable list
You can go to http://source.android.com/download to get instructions on how to download Android sources (images/drawables included), search for *.pngs and then reference the ones you need like this: getResources().getDrawable(android.R.drawable.ic_menu_save).
P.S. At least some of the drawables come with sdk: $SDK_PATH\platforms\android-1.5\data\res\drawable

Categories

Resources