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
1 answer

Android Bitmap Custom View on High Resolution Screens having poor performance

I am making a custom list view item. Extending View and overriding the onDraw method. private Bitmap bmpScaledBackground; //with size:(screenWidth , screenHeight/4) @Override public void onDraw(Canvas canvas){ …
Raytheon
  • 127
  • 1
  • 7
0
votes
0 answers

Custom View in UITableViewCell is cut off after scrolling

I have UITableView with custom UITableViewCells. The Cells contain a custom view, which is a slightly modified version of SSCheckBoxView (available on GitHub) When I scroll within the TableView and a cells disappears from the screen, the custom view…
Daniel H.
  • 243
  • 1
  • 3
  • 10
0
votes
1 answer

Custom View (MacOS)

I need to use a custom view (NSView *mainContent) and swap the view with a different nib based on the user selection from a NSPopUpButton. The IBAction method for the popup button looks like this: - (IBAction)menuSelected:(NSPopUpButton *)sender…
0
votes
2 answers

Android custom View not stretching to fullscreen for some screen sizes

I am expecting my app to run in fullscreen on all screen sizes using the android stretching capabilities Am using only one XML layout.
Ram
  • 13
  • 4
0
votes
2 answers

Custom View replace a TableView in landscape mode

I am working on an iOS app with a small table view in portrait mode. And I want this view to become something totally different in landscape mode. I haven't coded it yet, but something like…
f.c.
  • 23
  • 5
0
votes
1 answer

How I can rotate, zoom and move Image in Android

I'm new in ANDROID and want to rotate, zoom and move an image in my own custom view. But I write all of them(rotate, zoom, move) in same onTouchEvent method. So when I move image, it is also rotated or I zoom image,it is moved. I have to handle them…
angaraeski
  • 468
  • 1
  • 6
  • 12
0
votes
1 answer

Custom 3D Views for Android

I am about to start working on a new android app . The app is concerned with showing Images at most of the instances . I want to know if there are any cool custom views available for Presenting images more beautifully . The GridView and the Gallery…
Rahul Verma
  • 2,140
  • 3
  • 21
  • 31
0
votes
1 answer

setting the key listener to a custom View

I created a custom View Round button which consists of an image and some text. I tried to bind a method to it but it doesn't work and don't know what could be the reason. In the main.xml (layout file) i set the parameter clickable to true and in the…
Niko Gamulin
  • 66,025
  • 95
  • 221
  • 286
0
votes
1 answer

Connecting a view with the Inputmethod

I have created a custom view by extending the View class. On click I want the soft keyboard to pop up, just like it would with an edittext (ie with predictive text turned on and with the ability to select all available input methods). I have…
user987205
  • 43
  • 4
-1
votes
1 answer

issue with CustomView drawing in my application

What is wrong in my code here.why it is not drawing my customview on screen. class CustActivty extends Activty{ private ShapeDrawable mDrawable;; Path path; public void onCreate(Bundle…
Android Killer
  • 18,174
  • 13
  • 67
  • 90
-1
votes
1 answer

how to close a custom class like BubbleShowcase : UIView?

i have a class public class BubbleShowCase: UIView { public func dismiss() { animateDisappearance() } } how can i call that dismiss function on my View Controller ? i want to dismiss that custom view on custom tap
amaulana
  • 97
  • 1
  • 8
-1
votes
1 answer

Access programmatically generated CustomView objects by their ids

I am trying to access an object of a custom View created in button1 from button2 this way: final Button button1 = (Button) findViewById(R.id.generate); button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { …
Hussein
  • 653
  • 3
  • 10
  • 28
-1
votes
1 answer

subview not clickable in UIViewController

I'm trying to embed a custom view in UIViewController. But when displayed, it's not clickable since it's out of the UIView frame. viewDidLoad: @IBOutlet var theVC_InVC_Test: UIView! @IBOutlet var TableView: UITableView! override func…
OneOfThem
  • 23
  • 6
-1
votes
1 answer

Can you create a custom view?

I am trying to recreate a screen from one application (see picture). The problem I am facing is focused on the grid elements of the screen. Is it possible to create a custom view which is a combination of an image and a text view (like in the…
Vasko Vasilev
  • 554
  • 1
  • 10
  • 25
-1
votes
1 answer

How to create a custom view with nested xml as the content

I have a problem with creating a custom view component and then displaying the nested xml content when the control is defined in my layouts. I have tried iterating the children and only getting the nested elements and then using removeChild then…
1 2 3
42
43