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

Managing 6000+ contacts from a database

I have a a database with more than 6000 entries. I am using this example http://eshyu.wordpress.com/2010/08/15/cursoradapter-with-alphabet-indexed-section-headers/ to display the contents. But now the activity isn't able to handle it. I get a ANR…
Ragunath Jawahar
  • 19,513
  • 22
  • 110
  • 155
0
votes
1 answer

cannot use custom view(aar lib) in other project

i have an aar file(i make that) and i want use to another project's application app moudle. the aar have some custom views im using android studio 1.Problem 1) CustomViewLibrary Project java sources resources (strings, layouts, colors ...) *export…
Hyuk Park
  • 1
  • 2
0
votes
0 answers

Material Navigation Drawer

I have created a navigation drawer using Mike Penz's navigation drawer library which is as follows: but m facing an issue that my view is not scrollable like other items infact other items are getting overlapped on my view while scrolling Its…
Whisky
  • 327
  • 1
  • 3
  • 7
0
votes
2 answers

custom views in LinearLayout with weights - only first object is drawing

I'm trying to create a new custom view, and than put some duplicates of that (to be changed later by java, as in custom background etc) But out of 3 views I put in a linear layout, only the first one is getting drawn. Tried that with multiple custom…
Re'em
  • 1,869
  • 1
  • 22
  • 28
0
votes
1 answer

How to create a segue on pressing a UIButton that's locted inside a custom UIView with storyboard in XCode

Normally (when using XCode storyboard to create an UI) ctrl-drag does the job of creating a segue to an other view controller. Works perfect with an UIButton. But how to create a segue with ctrl-drag if the UIButton is located inside a custom view…
karldegen
  • 113
  • 8
0
votes
1 answer

How to change the fistDay in calendar full API but only for weekly, not monthly, etc

I am using https://fullcalendar.io/ API to create a custom view for Weekly events and monthly events. The issue I am facing is that for weekly view, I want the start of the week to be Monday (1) and monthly to remain Sunday (0). If I were to add…
0
votes
0 answers

b4a custom view stay empty space

i use native ads inside customListView module in my b4a project. when for any reason ads not loaded the space for ads stay empty. how can i fill the empty space ? this my code : Sub Activity_Create(FirstTime As…
batnight
  • 139
  • 1
  • 10
0
votes
2 answers

How can I make the Views defined in Android XML customs view file visible

I've the below code, that is having one element as shown in the XML file below it, and a call of the custom view named card package tk.zillion.app1; import tk.zillion.app1.CustomViews.Card; public class EmptyActivity extends Activity { …
Hasan A Yousef
  • 22,789
  • 24
  • 132
  • 203
0
votes
1 answer

iOS Swift 3.0 custom view in interface builder causes recompiling and misplacements

i did make some custom views to be able to reuse them in different controller .xib files. I do initialize them with: var view: UIView! var nibName = "MyCustomView" override init(frame: CGRect) { super.init(frame: frame) …
sneps
  • 387
  • 4
  • 13
0
votes
1 answer

xamarin form: Custom Renderer not get executed if Custom control in Shared library

I have two project in a solution: One is a library project and the later one is a main project of the application. The library project contains: shared library project, android, and iOS similar to the main project for the application. The library…
LittleFunny
  • 8,155
  • 15
  • 87
  • 198
0
votes
1 answer

Not able to click upon a custom view and recognize it

I made a custom view that represent a drawable with other attributes. I added more of custom views in a FrameLayout content into activity xml. So, I have a lot of custom views in the screen. These custom views where positioned using the datas…
0
votes
3 answers

Create Circle Image View IOS issue

I want to create a Circle image view for my profile avatar. I have tried this:- class CircleImageView: UIImageView { override func draw(_ rect: CGRect) { // Drawing code layer.masksToBounds = true layer.cornerRadius…
Avinash kumawat
  • 475
  • 6
  • 18
0
votes
1 answer

ios swift show custom view below Navigation controler

I am working with iOS swift application , I have create a custom view . I want that view will display on bottom/ below of my navigation controller. I have below case for that view: Portrait with Navigation controller Landscape with Navigation…
Kushal Maniyar
  • 846
  • 1
  • 8
  • 26
0
votes
1 answer

Custom compound view and .findViewById()

I am really worried about the .findViewById() method and its use in a custom compound view creation. I am not sure about the exact place that it is guaranteed that it will never return null. Let's say I have this custom compound view and that it is…
0
votes
1 answer

Synchronized scrolling of multiple custom views

I've got custom view, which draws a scale and handles touch event (horizontall scroll of that scale). Drawing part: @Override public void onDraw(Canvas canvas){ startingPoint = mainPoint; counter = 0; int i = 0; while (startingPoint…
Aleksey Bulin
  • 85
  • 2
  • 9