In iOS the "Window" is only one usually. And we can change the window's RootViewController and then the RootViewController's view is shown on screen.
How about android?
Is this picture real??? the PhoneWindow is under Activity?
If this is true, What is "Super Top View" on android like "Window" in iOS ( iOS's "Window" encompass all controller's view if the controller is window's RootViewController Right? )
Instantiates a layout XML file into its corresponding View objects
In Android every views are inside the Layouts thats in xml format even its activity or fragment its does not matter.
And also we can create custom views(button,textview...) and layout without xml data using programmatically java code.
Refer for more details
LayoutInflater
Related
What I am trying to do is to have a menu appear over listView. Just like in okCupid app :
when you click menu below the picture :
https://ssl.gstatic.com/android/market/com.okcupid.okcupid/ss-480-3-11
it extends itself over the background view :
https://g1.gstatic.com/android/market/com.okcupid.okcupid/ss-480-4-11
I have a feeling that this particular app is done in Sencha or JQuery mobile or similar technology but is it possible to get same effect in native app?
thanks
Most layout classes 'help you' by avoiding widgets to overlaps, but with the RelativeLayout you have more flexibility to create overlapping views.
To be sure the overlay view is on top, you can call ViewGroup.bringChildViewToFront() on the relative layout.
In your example the top view also has a partially transparent background.
Try using FrameLayout and add appropriate transperency for the view
I can look around for some example code later but the basic idea would be to have a MenuView class that draws your menu and animates in and out by setting the content of the menu visible or not.
Then just have all your content be on top of that MenuView by using the relativelayout align_parentBottom and set the content to above the menuview.
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
Is it possible to move a ImageView from one layout to another. If i move an image from one layout to another i get an exception "java.lang.IllegalArgumentException: Given view not a child of xyz layout"
If i long press on a application icon, the app is moved from app list view to workspace. How does the launcher do this. How is it able to move the app icon from one layout to another layout ?
I would think of it differently. Instead of moving the actual view object, your layouts should be able to create and remove the same type of view based on the data that the view represents. It sounds like you're doing a regular drag/drop from one layout to another. When the drop occurs in the new layout, this layout should be aware of the data that is dropped and be able to create a new view based on this data. The original layout should be aware that it has lost this data, and remove the original view. Thinking in terms of the data that the view represents instead of the view object itself is probably the way to go here.
Does anyone know how I can get my custom view object to appear in Eclipse's Android layout tool when I put the parameters in my layout file?
If you don't want to put any code here, just a link to a resource would be great too. I'm not having any luck searching for what I want.
Thanks.
Having your view displayed in the Layout View in Eclipse is not straight forward. From what I've seen (it's not exhaustive at all), using a completely custom View / Surface View with the rendering placed in a separete thread does not work.
But if you're building a custom View based on an existing one (for example inheriting from an EditTExt) and only overriding the onDraw method, then the layout manager will display your view as intended. The the parameters inherited from the Android View (here EditText) will apply to your custom View. Custom parameters won't have effects (I think).
I am working on creating a custom view in android. I want to create an autohide custom view control.
This control will be holding other UI elements mostly buttons or icons. It has a small button which is mandatory, clicking which will slide the control in or out thus changing its visibility.
one should be able to add other buttons or icons to this control
The control can be placed only at the borders, which needs to be specified while creating the view.
I don't know how to start with it
Should I be extending the View class or ViewGroup class.
have a look at this
and then you have to add a dynamic layout to this drawer
I used a RelativeLayout and added a Button to the View.
When I call expandView() or collapseView(), I call mybutton.setVisibility() and let RelativeLayout know it has changed with this.requestLayout().