Questions tagged [custom-view]

It is possible to create custom views by:

  • Compound views - combining views with a default wiring

  • Custom views - creating your own views

    a) by extending an existing view, e.g. Button, TextView, EditText, ListView, CheckBox, RadioButton, Gallery, Spinner, AutoCompleteTextView, ImageSwitcher, and TextSwitcher.

    b) by extending the View class

Creating custom views

By extending the View class or one of its subclasses you can create your custom view.

Creating your own View subclasses gives you precise control over the appearance and function of a screen element.

For drawing view use the onDraw() method. In this method you receive a Canvas object which allows you to perform drawing operations on it, e.g. draw lines, circle, text or bitmaps. If the view should be re-drawn you call the invalidate() method which triggers a call to the onDraw() method of this view.

If you define own views, ensure you review the ViewConfiguration class, as it contains several constants for defining views.

To draw your Views you typically use the 2D Canvas API.

Useful links:

644 questions
0
votes
2 answers

Android Thread implementation for custom View

I am trying to make a TicTacToe game for android . But i have the following problems. First and foremost i would like to implement threads to my app but i have not been succesfull ( have tried almost anything ) . Secondly i would like to…
0
votes
1 answer

Movable Custom UIAlertView over a tableView

I made a custom UIAlertView as Follows :- 1) I made a subclass of UIView which is of the size of the UIWindow and made its background Color as Clear , I made such so that , the user is not able to click on anything except the popupView 2) then I…
Subbu
  • 2,063
  • 4
  • 29
  • 42
0
votes
1 answer

Load CustomView and its logic at Runtime

I'm creating a custom component for an Android App (exactly a volume fader for an audio mixer). It works fine. What I want is to load several instances of this component at Run-Time. I tried with this: LinearLayout layout =…
rPulvi
  • 946
  • 8
  • 33
0
votes
1 answer

ABS CustomView - overflow menu

I'm working on a project where I need to replace the ABS with an customview. I have a button on the top right corner. When you click that button I want a Spinner/contextMenu/overflow menu shown (like the standard abs with overflow theme). The button…
0
votes
1 answer

Fitting View into Actionbar

I'm working on integrating a custom view into the action bar. Currently I am successfully getting the view to display. However some of the view is appearing off the edge of the action bar boundary. Is there any way I can set the action bar to adjust…
Javacadabra
  • 5,578
  • 15
  • 84
  • 152
0
votes
1 answer

iOS UITextField custom keyboard

I've a custom keyboard view on my app positioned at the bottom of my screen, it's based on Fabrizio Prosperi's FPNumberPadView. I also have a couple of UITextFields, I want this keyboard to ALWAYS be on screen, whether a textfield has the focus or…
David Homes
  • 2,725
  • 8
  • 33
  • 53
0
votes
1 answer

Adding Customview to UIScrollview results in stuck screen when Scrolling

I am adding a custom view dynamically and i get this exception EXCEPTION: ; symbol stub for: getpid ITMCustomView *cView = [[ITMCustomView alloc] initWithFrame:CGRectMake(187, 660, 400, 400) …
RookieAppler
  • 1,517
  • 5
  • 22
  • 58
0
votes
1 answer

Scroll view not functioning after adding custom controls

I am developing an app where i click a button and a bunch of controls (custom view) add at the bottom of the screen. I can click the button as many times as i want. So i end up adding controls at the bottom. I want to scroll up and count how many i…
RookieAppler
  • 1,517
  • 5
  • 22
  • 58
0
votes
1 answer

Yet another custom UIView subclass

I would like to create a custom class by subclassing the UIView that would look like the one below: Oh and the text says the body view should be 80px tall, its 50px. But I cant seem to get it right. I have the class header prepared like so: #import…
Majster
  • 3,611
  • 5
  • 38
  • 60
0
votes
1 answer

Catch BackButton inside Custom View

I want to report Video position when user presses back button. Video is played inside a Custom View implementation which is a part of SDK. So i dont have access to Activity's backButtonPressed method. I tried dispatchKeyEvent but it requires view to…
mehmet6parmak
  • 4,777
  • 16
  • 50
  • 71
0
votes
5 answers

custom view helper error in zend framework 2

I cannot seem to register a custom view helper in zend Framework 2.02 I tried all solutions posted here and anything I can think I should do but I keep getting this error: Fatal error: Class 'ModuleName\view\Helper\mylinkhelper' not found in…
paxtor
  • 331
  • 5
  • 17
0
votes
0 answers

Android custom view and XML

I can't figure out what's wrong with the code.. I tried several different things and nothing works.. So I have a class that extends a View because I need to do my own onDraw, and an xml where that custom view is placed. Ok so here's the…
Balkyto
  • 1,460
  • 4
  • 22
  • 47
0
votes
1 answer

Custom view not executing onDraw()

I have created a custom view named CustomViewVisual1 that draws on screen objects of the class Particle. I use this custom view in a class named LayoutCanvas that extends Activity. Neither onTouch() or onProgressChanged() events in LayoutCanvas seem…
Arch
  • 507
  • 3
  • 18
0
votes
4 answers

How do you display 2 overlapping view in a gridview?

I'm working on displaying images to the screen in a Gridview and currently am using an ImageAdapter to load the downloadeded images into the Gridview. If tapped, I'm drawing another image on top of the selected image to signify selection, the…
CA Bearsfan
  • 454
  • 4
  • 20
0
votes
1 answer

Android custom view can't use alignParentButton or wrap_content

I have a problem which I don't know how to solve. I have created a custom view and would like to align it to parrent buttom in a relative layout but when I do that the view gets transparrent?! How can this be? Also if I set the surrounding views…
7heViking
  • 7,137
  • 11
  • 50
  • 94