android-custom-view

java.lang.StackOverflowError: stack size 8MB while setting background image capture from camera

筅森魡賤 提交于 2019-12-13 03:59:05
问题 I am trying to capture image from camera and set the image as background for a custom view so I can draw on it.but i got an error. Below is the code causing the error ,could anybody guide me on the right path. private CustomView mCustomView; Uri uri; File file; Drawable myDrawable; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_draw_view); mCustomView = (CustomView)findViewById(R.id.custom_view); /

Adding custom View to LinearLayout dynamicly does not work

坚强是说给别人听的谎言 提交于 2019-12-13 02:41:39
问题 I have a layout like this: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/recipe_coordinator_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- Scroll View Layout --> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <!-- Main Layout--> <RelativeLayout android:layout_width=

StaggeredGridView setAdapter after addHeaderView and addFooterView

柔情痞子 提交于 2019-12-12 20:59:14
问题 I try to use StaggeredGridView in my new applicaiton. Everything is working fine. Now i want to add a HeaderView and a FooterView, but this gives me following error: java.lang.IllegalStateException: The content of the adapter has changed but ExtendableListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ExtendableListView(2131165194, class com.tundem.numbersreloaded.view.NumbersGridView) with

Draw over google map v2 android

风格不统一 提交于 2019-12-12 17:27:54
问题 I created an android app to draw free shapes over google map v2. The idea of the app is that I combines two apps, one is to draw free shapes and the other is normal google map v2 app. This link is my last question about this app and it contains the code The app works well with me but now I have a new problem. My problem is that when I draw a line over a specific location on the map and convert control to map and drag it, I found that the line keep in its place in the view and the map moves

Play Gif in either WebView or Custom View

亡梦爱人 提交于 2019-12-12 14:03:05
问题 In a nutshell, I have an Activity A, which applied setContentView(R.id.layout_a) , and A will run for 5 seconds. I tried to define a custom View class and using Movie class to load the gif, then attach the custom view to layout_a but it displays just blank. The WebView method I tried WebView, it can display the gif well, but the gif can animate only the first time I launch this activity. It will just show the last frame when later activity A is launched. I tried WebView.reload() but no sweet.

Draggable View not moving, calls ACTION_DOWN then directly to ACTION_CANCEL

萝らか妹 提交于 2019-12-12 13:13:33
问题 I have a custom view which can be dragged by touch here's the complete code. package com.neibrapp.neibr; import android.app.ActionBar; import android.content.ClipData; import android.content.Context; import android.gesture.Gesture; import android.gesture.GestureLibraries; import android.gesture.GestureOverlayView; import android.gesture.GestureUtils; import android.graphics.drawable.GradientDrawable; import android.support.v4.view.GestureDetectorCompat; import android.util.Log; import android

How to Inflate Extended LinearLayout from XML

本秂侑毒 提交于 2019-12-12 11:14:43
问题 Can anyone suggest a way to improve this API8 example? While they say the views could have been defined in XML, what they have in fact done is code them in java. I see why they wanted to. They have added some members to an extended LinearLayout, and the values are determined at runtime. According to oh, everyone in the universe, the layout directives should move to XML. But for this app, it makes sense to keep setting the text as-is in the runtime logic. So we've got a hybrid approach.

inserting textview inside edittext in android?

a 夏天 提交于 2019-12-12 10:55:31
问题 I am trying to insert a textview inside a Edittext as in below can anyone pls give me ideas about how to implement it or something. thanks :) update: the textviews in the edittext will vary dynamically. 回答1: I think you cannot set TextView inside EditText . But alternatively you can make it look that way. Here are the steps convert textview to BitmapDrawable convert bitmap drawable into SpanableString ( ImageSpan ) then set this returned SpannableString to your EditText I have recently

findViewById returns null in custom View after inflate

时光怂恿深爱的人放手 提交于 2019-12-12 10:54:56
问题 I have a custom RelativeLayout and I inflate an xml res file in it. This works fine if I use the custom layout in an xml file and set it as contentview, but if I try to add it in the code with new LocationItem(this) and addChild() the findViewById method always returns null in the constructor of the custom RelativeLayout . Here is the code: public class LocationItem extends RelativeLayout { private String parcelType; private int countIntoBox, countFromBox; private RelativeLayout

Custom arrows without image: Android

流过昼夜 提交于 2019-12-12 10:36:40
问题 I followed this tutorial: http://looksok.wordpress.com/2013/08/24/android-triangle-arrow-defined-as-an-xml-shape/ The tutorial is for creating custom arrows as increment/decrement buttons without having to use images. The shape of the arrows are fine however the up arrow is positioned with its base at the bottom of the button view and the down arrow is positioned with is base at the top of the button view. In otherwords, the arrows are not aligned properly. I was wondering, is there some sort