I am trying to design a UI as like in an iPhone app. The image of the design is as follows
In the above image all the white boxes are of a list view. In those list view i am placing an image View and two set of text view. I have placed a overall custom list view and in that custom list view using relative layout i have place the image view and two text view.
now i want to draw a line between the two text view and when i click on the second text view i am moving to a new activity. At that time i want to show that only the second text view is been clicked.
Use a RelativeLayout:
The image android:layout_alignParenLeftt="true"
the first two textViews android:layout_toRightOf="#id/myimage",
the other textviews below the previous ones (e.g. android:layout_below="#id/author" and with a layout_width="fill_parent"
Check Romain Guy's blog post for a tutorial on a similar (simpler) setup: http://android-developers.blogspot.com/2009/02/android-layout-tricks-1.html
Check this http://www.androidsnippets.com/clickable-listview-items
The ClickableListAdapter bases on the
API-Demo-Example "Efficient List
Adapter". It was refactored to provide
a better reusability. Additionally,
you can connect OnClickListener and/or
OnLongClickListener to each View of
your list item. This allows you to
create complex interactive lists, or
simply using a customized checkbox
version.
I had implemented this in a project minus the image view. Heres a screenshot.
Related
i am trying to design dynamic ui layout in android to present the date like the image below. i am **facing the challenges in the creating an view as clustered in the below mail **
i tried using list view!
but the each appeares in diffrent line, it dose not lookes like the image as below! is that possible to design like this. if so how to do that?
Try to create a few custom views, e.g. this circles with dates, this labels on the left and rights with xml layouts. Next, create parent view with some container layout, e.g. FrameLayout. In this parent view override it's onDraw() method, and there manually create and add every layout. It is simple, but might be not efficent, when there are many of views
Need some help!!..
I'm try to implement a list view with two images in the initial screen, after scrolling other images can be seen.
Can you suggest anyway to implement it!
Use can achieve it by creating custom adapter for list view. Have a look :-
http://www.learn2crack.com/2013/10/android-custom-listview-images-text-example.html
You need to do some updation like removing text view from custom list layout.
I've a screen with the following layout
Also I've a list view
How can i bring a box like background (similar to first screen) for the list view
out may look like
Is it possible to do with ListView? any suggestions, i can post the code for the current layouts if necessary
Put your list in a layout.. set the background and add padding ... for list listview again put up background.
I have a gridview of images in android. When i click any item on it, i want to show a new set of items over it. This is the screen shot .
Can this be done using gridview? Also what should be the type of view which must come over the gridview? The background should become preferably faded.
I am not so sure if you can achieve the second view using a grid view. In the grid view AFAIK you don't have any option of specifying the location of the grid elements. It just arranges it from left to right and wraps around.
But here is how I would do it -
First view can be done using the grid
view, as you already know/done.
For the second view since you want the the first view to remain in the background, there are two ways to go about this -
First option
You can use a dialog, you can create your own custom dialog which has makes it translucent.
In this custom dialog you can add further elements like images.Custom dialog example. For details on how to make it translucent you can look the sample app in android sdk.
Second option -
Use a layoutInflater. Put all your views into it.
You can display one view on top of another using the visibility attribute of the view. Layout Inflater
I have ListView. I would like to fill each row of ListView with a background from left to x% ...
So what I want is:
Item - 50% of background is colored
Item - 20% of background is colored
Item - 90% of background is colored
Is it possible to this?
Thanks for the answer!
As far as I know this is not possible out of the box. But I think you can archive is with a little trick.
You have to define a custom view for you rows. This view has a RelativeLayout as root element on which you can set the background color you want to have.
You then add another view element to the root element which covers a part of the root element. The background color of this element should be set to black and should be aligned to the right. The RelativeLayout provides many attributed you can use to arrange the elements.
Furthermore you have to write a custom adapter which handles the creation of the single list items views. When you override the getView() method where the view elements for each single row are created and inflated to the ListView, you calculate and set the width of the "cover"-element in such a ways that it covers a part of the root element.
The difficult part will be to calculate the width of the cover-element so that the rest of the root element which is not covered and still visible correspond to the percentage you want it to have.
Here you find a short tutorial about how to implement a custom Adapter with a custom view for the list items.
It is possible by the concept of custom layouts. This is a good article for to learn more. Also, I think you need to go through the NotePad tutorial in Android official site.