custom-view

How do I get a view in Interface Builder to load a custom view in another nib?

放肆的年华 提交于 2019-11-30 06:24:33
问题 I am making a custom widget that I would like to use in multiple nibs. So I make a new view nib Screen3, add some buttons, and now want my UIAwesomeSauce widget. If I just add a view and then change the Class Identity, it doesn't get the subelements from the UIAwesomeSauce nib. Same thing if I go to the Library and switch to Classes. It seems only a UIViewController has the field for "Load from nib", which would be beautiful. I know I can load the UIAwesomeSauce nib from code, get the top

How to pass view reference to android custom view?

谁说我不能喝 提交于 2019-11-30 06:10:50
I did as follows 1) Creating a styleable <declare-styleable name="Viewee"> <attr name="linkedView" format="reference"/> </declare-styleable> 2) defining custom view layout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#ffc0"> <TextView android:id="@+id/custom_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="[text]" /> </LinearLayout> 3) Creating required class public class Viewee extends LinearLayout { public Viewee(Context context,

Can a custom View know that onPause has been called?

可紊 提交于 2019-11-30 04:14:58
I have a custom View that runs a Thread operation which sits around making calls to the interwebs periodically. I would like to know if there's a way for me to not have to kill that thread from the parent Activity (onPause) so that the Thread isn't milling about in the background after the Activity has been backgrounded (and/or killed). The intention here is for the custom View to be self sufficient and not need additional handling from the Activity. The way to do that would be for it to listen for when its parent was backgrounded and for it to then let the infinite sleep loop in the Thread

How to create a simple custom View?

烂漫一生 提交于 2019-11-30 03:22:50
问题 I would like to create an custom View on Android. I have tried to do it as simple as possible and created an almost empty class MyView and used it in my LinearLayout but the application fails on start with "Force Close". How can I do a simple custom View ? According to Building Custom Components the View gets the size 100x100 if I don't override onMeasure() . public class MyView extends View { public MyView(Context context) { super(context); } } And I use it in a LinearLayout with: <view

Android: Custom view based on layout: how?

一个人想着一个人 提交于 2019-11-29 14:51:16
问题 I am building a Android app and I am a bit struggling with custom Views. I would like to have a reusable View that consist of a few standard layout elements. Let's say a relativelayout with some buttons in it. How should I proceed. Should I create a custom view class that extends RelativeLayout and programmaticly add those buttons? I would think that's a bit overkill? What's the way to do it properly in Android? 回答1: Here are some rough steps regarding one way to create a custom aggregate

Android Sliding Up View

不问归期 提交于 2019-11-29 07:54:42
I need to do a Sliding Up View wich should slide up from the bottom of the screen when I click a button. It has to show on the bottom of the screen and I need to slide/drag it to the center of the screen. The images below explain it better. almost like the AndroidSlidingUpPanel from "umano" which you can find here : The problem is that I want the first child (The content of my View - an image for example) to fill all the screen and also I want the second child(the actual bottom bar) to be showed when I click a button. The images below explain it better. If there is not possible to do this by

How to pass view reference to android custom view?

♀尐吖头ヾ 提交于 2019-11-29 06:37:41
问题 I did as follows 1) Creating a styleable <declare-styleable name="Viewee"> <attr name="linkedView" format="reference"/> </declare-styleable> 2) defining custom view layout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#ffc0"> <TextView android:id="@+id/custom_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="[text]" /> </LinearLayout>

Slow load time for custom UIView with UITextView property in Swift

烈酒焚心 提交于 2019-11-29 02:57:04
I originally asked this question . I had assumed that the reason for the slow load time of my custom view was because of layering multiple views on top of each other or perhaps because of some recursion problem . However, after cutting out more and more code to see what would make a difference, it came down to whether I had a UITextView present or not. Because the apparent source of my problem is so different than what I was expecting in my first question, I decided to start a new question rather than adding a lengthy update to the old one. I set up my test project with two view controllers. A

Custom View Extending Relative Layout

我的未来我决定 提交于 2019-11-28 23:13:01
package com.binod.customviewtest; import android.content.Context; import android.view.LayoutInflater; import android.widget.RelativeLayout; public class CustomView extends RelativeLayout{ public CustomView(Context context) { super(context); // TODO Auto-generated constructor stub // LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater mInflater = LayoutInflater.from(context); mInflater.inflate(R.layout.custom_view , this, true); } } Including as <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns

How do I get a view in Interface Builder to load a custom view in another nib?

寵の児 提交于 2019-11-28 17:53:42
I am making a custom widget that I would like to use in multiple nibs. So I make a new view nib Screen3, add some buttons, and now want my UIAwesomeSauce widget. If I just add a view and then change the Class Identity, it doesn't get the subelements from the UIAwesomeSauce nib. Same thing if I go to the Library and switch to Classes. It seems only a UIViewController has the field for "Load from nib", which would be beautiful. I know I can load the UIAwesomeSauce nib from code, get the top level objects, and place it by hand. But the point of IB is so you don't have to place things in code.