Irregular Shaped Views Or Buttons
Dec 31, 2011How can i make a custom shaped clickable view or button? like a pentagon which is clickable.
View 2 RepliesHow can i make a custom shaped clickable view or button? like a pentagon which is clickable.
View 2 RepliesI have touched on this question here, where Christopher gave an answer to this, but I dont really get it so I thought its time to make it a real question, not just a "follow up" =)
As it stands, the application Im writing has 4 different screens:
1. Screen 1 - list of nodes (main screen)
2. Screen 2 - options menu, tableLayout with buttons
3. Screen 3 - navigation
4. Screen 4 - text details on version etc
These screens can be navigated to/from using a "header" View that is placed on top. the header then has 4 different buttons:
+--------------------+
| menu with buttons |
+--------------------+
| |
| |
| |
| C O N T E N T |
| |
| |
| |
+--------------------+
The header is just an XML-file (header.xml) with a few buttons. That header.xml is the included in the Layouts using the include-markup. For example, the main.xml has the line:
<include layout="@layout/header"></include>
The header show up alright, but the question is - what is the correct approach to attach OnClickListeners for the buttons in the header?
Christopher pointed out that you could create an Activity class and do the hooks there, like this:
CODE:............
First, I cant make it work since the method setupHeaderButtons isnt accessible from FirstActivity.
Secondly, is this the right way to go at it?
I've got viewpager working as it should, but i can't figure out, how to make the buttons inside the views in viewpager work,
View 2 Replies View RelatedI am developing a application which needs to change the color of the irregular shape such as the shape of a rabbit...but you know, if you use the APIs,you will change all color of the rectangle shape.
View 2 Replies View RelatedWill I still be able to use the Arc shaped unlock bar if I update to 2.1?Its kinda silly but one of the reason why I got the X10 is because I hated the bar unlock from my iphone.
View 1 Replies View RelatedI have a simple ListView and on that ListView I have placed a number of custom defined Views. The CustomView has ImageView and two TextViews.
The CustomView also has a "stateful drawable" as background, so that the background image (a 9-patch) changes if you press the Row in the ListView. When pressing the Row, the background image changes to a Red-ish thing.
The problem is that when the background changes from the default greyish, all the Views in the CustomView (ImageView and TextViews) still have their greyish background and thus creates very ugly greay boxes on top of the now redish background.
What is the best way to solve that problem? I hoped that such things were handled automatically (as it is done in for example .NET), but I was wrong it seems.
I'm having trouble switching views with button presses in my Android app. The code shows no errors in Eclipse, but the app quits unexpectedly in the emulator when the button is clicked.
View 1 Replies View RelatedI am implementing a music player application in Android. My play list selection screen is implemented as a tab selector widget which contains a ListActivity inside each of the tabs: Artist, Albums, Songs.
I want to update the ListView in each of the ListActivity when I delete an item from any of the lists.
i.e. When I long press an item in the Artists list a context menu is drawn with "Delete Artist"
And it should delete all the songs from this artist in the Songs ListView, delete all the albums by this artist in the Albums ListView, and finally delete the entry for the artist in the Artist ListView.
Each of the ListActivity has its own fillData() method, which updates the ListView when the button in the context menu is pressed.
How can I call the fillData() method of the Albums ListActivity after I update the ListView inside of the Artists ListActivity?
I want to populate a table, defined in layout xml file through the programmatic way. I have define Table with a single row defining its header, with all the attributes set. Now i want to know a way so that i can just replicate that header row in the table with new content.
I tried using inflator inflate(int,view) method, but at runtime it showed up with error.
Here is the XML code for the layout file defining the table
CODE:.................
I have the following XML code:.................
The idea is to change the views, whenever I press one of the radio buttons. When I press a button the first time everything works out fine, but the second time I press a button, I get an IllegalStateException, and I can't quite see why I'm getting this.
Also, the Activity seems to set all my global variables to null, which is why I have to create them every time I switch from portrait to landscape or vice versa. So I would like to know if there is a way I can save my views in the Bundle, or any other way in which I can permanently save my views, so I don't have to add or create them every time, I flip the phone. And whenever I flip the phone, it seems that it rereads the main XML file, causing the RadioGroup to be set to 2D even if the 3D button is checked. This is because I've said the 2D button to be checked from when the app is first created, but I would like to also save the state of that RadioGroup.
How do you align views relative to the "middle" part of another view? I think it is best explained with a pic of the UI I'm trying to create in android.
View 2 Replies View RelatedLet's say I have a LinearLayout, and I want to add a View to it, in my program from the Java code. What method is used for this? I'm not asking how it's done in XML, which I do know, but rather, how can I do something along the lines of (One View).add(Another View) Like one can do in Swing.
View 2 Replies View RelatedIs there any way to query a root view of an activity for all of its child views even before the root view or its children have been inflated? I guess what I'm looking for is whether a view knows ahead of time what children it will have before it gets inflated, and can I get that list in some way. Bizarre I realize, but I think it will help me with some unconventional automation testing I'm working on. I haven't found anything in the API like this.
View 1 Replies View RelatedI am not able to find out the perfect layout(viewgroup) to place four buttons as shown in the attached image. Basically, i want to place four buttons near the top/left/bottom/right edge of the screen. AbsoluteLayout helped, but it is deprecated (It is also better to avoid AbsoluteLayout as it is not very flexible for orientation changes)
View 2 Replies View RelatedI am working on an Android app that has multiple screens the user will need to navigate between and I am curious what the best practices are when switching between those screens. I am torn between creating a new Activity for each screen and simply changing the view (setContentView(R.layout.whatever)). The screens all share at least some variable values so I'm leaning toward changing views and using class level variables, but I'm worried a single activity could become very large and confusing with logic for multiple screens in a single file. I'd like to keep the code clean and separated, but I also don't want to be passing several variables around between views if that isn't needed.Being new to Android development, I'm hoping some more experienced members of the community could share their thoughts and let me know how best to handle it
View 2 Replies View RelatedI'm new at this, I have not seen any examples on changing Views, what I want to do is when a user presses a button I want to show a map view based on their input on the first view.
View 4 Replies View Relatedim having a problem getting a custom view that i created on the xml layout file. i have a class named DrawingLayout which extends FrameLayout. it is found in the package Drawing
as stated on this page http://developer.android.com/guide/topics/ui/custom-components.html i used the following decleration in xml
<Drawing.DrawingLayout ... />
but whenever i run the program with that decleration i get a runtime exception error on SetContentView( ... )
is there something im not doing well? If you need any more details please tell me because i cant seem to figure this one out.
I 'm beginner in Android ,To start with i was asked to do a simple task ,i need to make blue and red screen appear on the screen alternatively , to achieve this i wrote two layout files 1. main.xml -- for to display red screen 2. sub1.xml -- for to display blue screen
In oncreate() i wrote
for(int i=0;i<20;i++) { setContentView(R.layout.main); try { Thread.sleep(500); }catch(Exception e){} setContentView(R.layout.sub1); }
but this doesn't work ,why ? Please help to understand the concept
I currently have one Scrollview which contains a table layout and one list in my activity. Now my problem is that I wanted to move both of them(Scrollview and list) together and with proper synchronization... So if scrollview is being scrolled then listview should also scroll with the same distance, and vice versa...
View 5 Replies View Relatedwhats the exact differences between 1. LinearLayout lin = LinearLayout.inflate (ctxt, R.layout.bla, null); parent.addView(lin); and 2. LinearLayout.inflate(ctxt, R.layout.bla, lin);? Both doing the same thing, or?
I got sometimes a different behavior.
I am using 5 views in one LinearLayout my app.While going to each view i am removing previous view by calling linearlayout.removeAllView(). But I think this is not removing my previous view becoz when i checked memory usage.My app memory is keep on growing.and Becoz of this i am getting low memory :no more background process error and after sometime app is getting hang and then it is exiting.Please help me to solve this problem.How can we clear memory or how can we remove view.Its very urgent.I am using system.gc() and also i cleared object also but no use... I tried to use different activity for each View but at that time low memory is coming immediately.
View 2 Replies View RelatedI have a login page which has a Advanced button. The button sets a view where a user can add some information. When I click save, it goes back to my main view (loginpage) and all info is cleared? How can I save the state of the first view when navigating away and then back to it?
View 2 Replies View RelatedI have the instance to my activity, and I want to get all the views that are in this activity. I need to add a listener to each view, for any activity. That means I can't user findViewById. Is there any way to do this? I was hoping for a activity.getViews() or something, but it doesn't exist.
View 4 Replies View RelatedIs there a way to get every view that is inside my activity? I have over 200 views including buttons, and images, so i want to be able to access them by using a loop.
View 1 Replies View RelatedI have a set of views that are populated with data from an online database. The context menu has a "refresh" choice that re-reads the online database and updates some attributes of the views, like setText and setChecked for some buttons. After the various setTexts and such, I invalidate the Views. However, they are not immediately redrawn. In fact, they don't get redrawn at all unless something like a rotation happens to cause a redraw of the screen. How can I initiate an immediate redraw after the refresh is complete?
View 4 Replies View RelatedHow can I add some buttons below ScrollView that always stay on screen.
View 3 Replies View RelatedCan anyone tell me what views can I use in an appWidget?
View 2 Replies View RelatedI currently have one Scrollview which contains a table layout and one list in my activity. Now my problem is that I wanted to move both of them(Scrollview and list) together and with proper synchronization...
So if scrollview is being scrolled then listview should also scroll with the same distance, and vice versa...
I'm working on a game that in some ways is similar to Tetris (imagine a 2D array of colored squares that sometimes move around)
I am trying to animate the individual squares so they will smoothly slide down from coordinate to the next. Since I wanted to use Android's built-in tweening feature, the animation has to apply to the whole View (rather than parts of it). This doesn't work well for me because I only want some of the colored squares to slide down, and the rest of them to stay still.
The (theoretical) solution I came up with to resolve this is to make 2 Views, layered directly on top of each other. The top view is for animating squares when they need to move, and the bottom layer is for the static squares. The animation-layer is transparent until I am ready to animate something. I then simply turn on the colored square in the animation-layer, tween it to the new location, and turn it back off when done. In the same time span, the static-layer just turns squares on and off at the right time to make the whole thing look seamless to the end user.
The proposed solution is just a theory, since I haven't been able to make it work correctly yet. Since I have been having trouble, I was wondering if this is even the best way to solve the problem? Perhaps there is a more elegant solution that I am over looking?
I'm currently working on a game for android.
I have three ImageView's next to each other, they're positioned next to each other using the "android:layout_toRightOf". The views are located within a RelativeLayout tag. Each of these views are centered into the middle of the screen using "android:scaleType="fitCenter"" and they fill the entire screen.
I'm attempting to implement a horizontal scroll from one view to another so that I basically get one view on my screen at a time.
Here is the code that I'm currently using
CODE:................
What I'm currently getting is three images next to each other -- but sometimes they take up less then an entire screen. I want both the left and right padding to be correct, so that I can only see one image at a time.