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

Multiple Custom View (derived from RelativeLayout) in one line

I have created a custom view by extending Relative Layout and it looks like this: The layout for the view:
Sameer Segal
  • 21,813
  • 7
  • 42
  • 56
0
votes
1 answer

Add image, which drawing with UIBezier or CGContextRef into UIView sublayer

In this code I use CGContextRef to create next picture on my UIView: CGMutablePathRef arc = CGPathCreateMutable(); CGFloat lineWidth = 16.0; CGContextRef cont =…
0
votes
1 answer

UIImage Inside Custom Shape and animation

I need to draw a shape like that one: And animate the color path when you are scrolling. I have been for 2 hours trying several things but don't reach the final way to overcome that. I have tried creating a custom UIView, create a CShapeLayer and…
Sergio
  • 82
  • 7
0
votes
1 answer

Create Customize layout in Android

How to create Customize Layout in Android? My problem is I'm displaying Images in grid view, when the user reaches the last image in the grid view, it must display the message: "click here to View More Images"
Sankar Ganesh PMP
  • 11,927
  • 11
  • 57
  • 90
0
votes
1 answer

widthMeasureSpec is 0 when in HorizontalScrollView

I'm writing a custom view in Android. Since I need precise size management, I've overridden onMeasure. Its documentation says, that View.MeasureSpec.getMode returns one of three values, defined as constants. But when my view was placed inside…
Spook
  • 25,318
  • 18
  • 90
  • 167
0
votes
2 answers

View.setVisibility(View.VISIBLE) with custom adapter

I have something like this as my item_row for a listview
Eduvm
  • 1,131
  • 8
  • 14
0
votes
1 answer

how to load xib files in mainView controllers in ios

I am very new for iOS and in my app I am loading UIView xib file in my mainView controller and here in this xib file i have inserted one UITextField but when i insert text in that text it's not applying please help me. mainViewController:- #import…
AbhiRam
  • 2,033
  • 7
  • 41
  • 94
0
votes
1 answer

Android findViewById() returning null for custom view

So I've checked all of the other threads on this topic repeatedly but none have yielded the solution. Here's the code: The XML
0
votes
1 answer

how to remove the empty cell of custom list-view in my android application

Hi i am doing an application in which i want to show the content depending on the custom and the public ,data is coming from the sever.i am receiving the is_public as a parameter value as 0 and 1 if it is 1 it for public, we need to display to all…
0
votes
1 answer

Creating a customized list of custom views

I want to create a list like seen in the picture below and was wondering which one of androids controls would be the best option to do so? For every row in the list I could use a custom view that has max-Val and current-Val, then draw a rectangle…
user1768685
0
votes
1 answer

iOS - Add a UIView to a specific segment in a UISegmentedControl?(using Interface Builder?)

I want to add some badge functionality to a certain segment in my UISegmentedControl and add some constraints but looking in Xcode there doesn't seem to be anyway to work with individual segments within the UISegmentedControl in Interface Builder.…
cspam
  • 2,911
  • 2
  • 23
  • 41
0
votes
2 answers

how to inflate a view class in main.xml

How could i inflate my custom view using the main.xml file? I thought it carried the format of but I cant seem to get the fully qualified name of my inner class right. My customView is inside of my…
jfisk
  • 6,125
  • 20
  • 77
  • 113
0
votes
3 answers

How to create a custom UIView?

I've created a UIView subclass and corresponding xib file where I've laid out some UILabels and UIImageViews. I want to then put multiple copies of this custom UIView into a UIViewController. When I do that they appear blank in interface builder…
xmr
  • 635
  • 8
  • 9
0
votes
1 answer

Android FrameLayouts in GridLayout not showing

I'm trying to make something like the following screenshot (it's from an assignment from school): As mentioned in the assignment, I have an Activity PlayActivity: public class PlayActivity extends ActionBarActivity { …
0
votes
1 answer

NSViewController and custom views

So I have this layout. I need to load three views into it, the big view, which is part of the NSWindow. The sidebar view and the bottom view. I almost managed to do it but cant put my finger onto how to complete the process. I want those views to…
Dmitri K.
  • 197
  • 1
  • 13