custom-view

Android ProgressDialog with setContentView

十年热恋 提交于 2019-11-27 02:53:07
问题 I've read a hell of a lot about this, and can't see anyone who's done or tried it before. So I've got an object that extends ImageView, then within this I call a progress dialog and set the progress dialogs's content to the imageview (i.e. attempting to draw the progress dialog in the imageview..view.) loadingProgressDialog.setContentView(this); //this is: LoaderImageView extends ImageView loadingProgressDialog.setIndeterminate(true); loadingProgressDialog.show(); And I get the error:

Android drawing button to canvas with custom view?

大城市里の小女人 提交于 2019-11-27 02:17:28
问题 How can I draw a button on top of the canvas in a custom view? (Preferably on the mid-right side) Is there something I have to call before doing the button.draw(canvas)? public class MyClass extends View { public Simulation(Context context) { super(context); pauseButton.setText("TestButton"); pauseButton.setClickable(true); pauseButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Log.i(TAG, "Button Pressed!"); } }); public onDraw(Canvas canvas) { super.onDraw

Android - Is it possible to create a custom library to use across several applications?

十年热恋 提交于 2019-11-27 01:34:09
问题 Is it possible to create a custom library in Android (having its own layout resources) for use across several Android applications? I created a regular *.jar file but when I tried to create/style my views dynamically most of the properties do not work. Even referencing simple styles from the android.jar file such as android.attr.listSeparatorTextViewStyle did not work. I created an Android project without any Activity, having its own resource files and then referenced this project from

Camera with Custom View

主宰稳场 提交于 2019-11-26 21:15:54
My Application uses camera, I would like to add overlay over the camera preview. For example, I want to use a picture frame when I use Camera, also I would like to add a custom bar for camera operations. Kindly help me to do the same. You might be trying using UIImagePickerController. But I know this one solution to your problem. You can do it easily using AVCamCaptureManager and AVCamRecorder classes. Apple has a demo program build on its developer site here . It is named AVCam. In simple words what it does is when you click to open the camera, it calls the classes and methods which are

Android Custom View Constructor

谁都会走 提交于 2019-11-26 20:06:42
I'm learning about using Custom Views from the following: http://developer.android.com/guide/topics/ui/custom-components.html#modifying The description says: Class Initialization As always, the super is called first. Furthermore, this is not a default constructor, but a parameterized one. The EditText is created with these parameters when it is inflated from an XML layout file, thus, our constructor needs to both take them and pass them to the superclass constructor as well. Is there a better description? I've been trying to figure out what the constructor(s) should look like and I've come up

Android custom view Bitmap memory leak

回眸只為那壹抹淺笑 提交于 2019-11-26 19:37:30
问题 I've got a custom view in which I need to draw two bitmaps, one is a background, representing the image of a map and one is a pin which will be drawn on top/left position in canvas. The both images are drawn onDraw and remain the same during the live of the activity that contains the view. After a while I get a OutOfMemoryError: bitmap size exceeds VM budget This means that I have a leak and the bitmaps don't get garbage collected. I asked this question before, but now the situation changed a

Multiple choice list with custom view?

*爱你&永不变心* 提交于 2019-11-26 17:58:58
问题 I've seen example com.example.android.apis.view.List11 from ApiDemos. In that example, each row takes the view android.R.simple_list_item_multiple_choice . Each such view has a TextView and a CheckBox . Now I want each view to have 2 TextView s and 1 CheckBox , somewhat similar to the List3 example. I tried creating a custom layout file row.xml like this: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation=

android data binding with a custom view

陌路散爱 提交于 2019-11-26 15:23:49
问题 The Android data binding guide discusses binding values within an activity or fragment, but is there a way to perform data binding with a custom view? I would like to do something like: <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"> <com.mypath.MyCustomView android:id="@+id/my_view" android:layout_width="match_parent" android:layout_height="40dp"/> </LinearLayout> with my_custom_view.xml : <layout> <data> <variable name="myViewModel" type="com.mypath

Android ImageView size not scaling with source image

纵饮孤独 提交于 2019-11-26 15:07:12
问题 I have a few ImageViews inside a LinearLayout. I need to scale down the ImageViews so that they maintain their aspect ratios whilst fitting inside the LinearLayout vertically. Horizontally, I just need them to be adjacent to each other. I've made a simplified test bed for this which nests weighted Layouts so that I have a wide, but not very tall, LinearLayout for the ImageViews - <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"