Wrap content inside box - android

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.

Related

How does Android do its spinner style with the triangle icon in the corner?

I've spent way too much time researching this, but I'm wondering if anyone can provide any insight to how Android does its spinner styling with the triangle dropdown indicator?
The reason I want to know is that I am using a custom textview as spinner item, and once I use that I lose the triangle. In addition, I want to make the triangle white.
I've seen previous answers with modifying the theme but I don't want all spinners to change so I don't want to modify the entire theme. I want to learn how Android does the triangle so I can recreate it. I tried using a list-layout drawable with a triangle shape but I'm wondering if there is a better way?
You can set drawbleEnd
android:drawableEnd="#drawable/imgresource"
create an image of how you want as your spinners background with whatever type or triangle and whichever color your want and then set that image as the background of your textview like this
android:background="#drawable/myBackground"
It a simple Nine Patch Drawable.
You can create a NinePatch graphic, set a black dot on the top and left to expand the top and left edges. With a triangle in the bottom right.

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

Drawing indicator between activated list row and main fragment

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).

Android: EditText design

I have an EditText view which I need to look like below (focused and non-focused versions).
Also I have two following images:
Can I somehow just set these images as a background to make EditText look like above, not depending on its width? Or do I need to create some additional image files? Or some other solution? I'm a complete newbie in designing UI, so I'd appreciate any help and any comments on subject.
You first need to create a 9-patch graphic for each of your images. These specify how the image is stretched, and how the content is padded.
Then, you need to create a selector xml drawable to use one image or the other, based on the EditText state.

Why my ProgressBar looks different in different layouts

I used style="?android:attr/progressBarStyleLarge" to create the spinning ProgressBar.
Not sure why in different layout XML it behaves differently(I am using the same device).
It shows as a blue spinning circle and a circle of gray dots. I want to use the blue spinning circle in all my pages..
please advise!
Sorry that I don't have the reputation to upload pictures.
I think its dependent on background color of the layout. once put all layouts background color to black or some unique color. Then it will look uniquely.
If you want to put as unique for all pages the solution is:
Maintain same background color for all views
Otherwise use custom progress bar.

Categories

Resources