android-custom-view

Adding my custom View into an XML layout throws exception

牧云@^-^@ 提交于 2019-12-12 10:35:25
问题 I'm trying to create my first custom View subclass GraphView and add it to my layout XML file. I found this SO question and tried to apply it to my project, but something seems to be wrong because Eclipse IDE tells me: de.muza3000.graph.GraphView failed to instantiate. and throws an exception: java.lang.NoSuchMethodException: de.muza3000.graph.GraphView.<init>(android.content.Context, android.util.AttributeSet) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class

Invalidate doesn't cause OnDraw

僤鯓⒐⒋嵵緔 提交于 2019-12-12 10:15:33
问题 I have problem with my Android app. I've created custom view (http://syedwasihaider.github.io/blog/2015/07/12/XamarinViews/ up to step 2), overriden onDraw and I draw black screen and text "Draw {i}" where i is number that increments every time onDraw occurs. I want to call this method 30 times/second (or 60), so I've set up timer that causes Invalidate() every 33 ms. But Invalidate() doesn't cause onDraw at all! (It's not like its a delay between invalidate and ondraw, ondraw isn't called at

Add labels above Seekbars steps with different font size, vertically aligned to seekbars thumb

时光总嘲笑我的痴心妄想 提交于 2019-12-12 10:12:41
问题 I would like to create a Seekbar , above which there will be text label on each Seekbar step, what it should look like is shown in below image this is the expected result, for which what i have done, <RelativeLayout android:id="@+id/layout_font_size" android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/txtFont_size_hint" style="@style/textStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Aa" />

setMargins method is not working on custom ViewGroup

99封情书 提交于 2019-12-12 10:06:52
问题 I am working on a project where my portion of work is to create a sliding layout on main screen which will partially appear at bottom when the app will start and we can scroll that layout. And then I have to add child views inside of it which will be cards. Now for that I have created a custom ViewGroup and I will add them programmatically. I have succeed in making most of the portion of the task. I have created a custom FrameLayout for sliding layout. Then I used it and added in XML. <?xml

custom made arc shaped seekbar

倖福魔咒の 提交于 2019-12-12 09:04:44
问题 What I am trying to achieve is to make an arc shaped seekbar. I know there are plenty of libraries I could use to achieve this, but I am just trying my hands on custom made views. I have encountered couple of problems: I have a class which extends SeekBar, and I have implemented onDraw and onMeasure methods as well, but I am not able to view that in layout editor in eclipse, here is the code for the custom view class: package com.custom.android.views; import android.content.Context; import

How to use Path (android.graphics.Path) with canvas in android?

拟墨画扇 提交于 2019-12-12 07:45:14
问题 I am working on a Custom View that implements Catch application like Circular Menu. After spending a lot of time, I have made a bit of progress, completed outer semi-circle with multile colors. Now, reading an answer provided by developer of Catch application to an user for his query, I came across the class Path. Google Android Developer page does not provides enough material to be understood and to be familiar with Path. so, Please ? Anyone ? Thanks in advance. 回答1: You can use it to draw

Why EditText in a custom compound view is re-using the text entered in another compound view instance?

懵懂的女人 提交于 2019-12-12 07:09:49
问题 I'm trying to write a custom compound view composed by a TextView and an EditText , _compound_view.xml_: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/compoundText" android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:id="@+id/textLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Label" /> <EditText android:id="@+id/textEdit" android:layout_width="match_parent"

Android: Action bar home button customize

非 Y 不嫁゛ 提交于 2019-12-12 06:08:06
问题 I am developing an application in which what the need in action bar is shown in image: I need to apply back arrow with text and search icon custom from drawable. My API level is from min 13 to 21 max. I searched on Google and found to do this from style.xml as: <style name="Theme.MyFancyTheme" parent="android:Theme.Holo"> <item name="android:homeAsUpIndicator">@drawable/my_fancy_up_indicator</item> </style> But its not working. I also tried : getActionBar().setDisplayHomeAsUpEnabled(true);

Custom AutoCompletevView like facebook comments field in android

大憨熊 提交于 2019-12-12 05:29:33
问题 I want to make custom AutoCompleteView like this.. It should be populated when my special character is added (like facebook.. When you type @B then all friends those name starts with 'B' will be populated and we can select name). It should not be populate while typing until '@' is added. When '@' is added autocompleteview is dropped down and we can select name and after selecting it will be appended. I found this but not satisfied. I need clue. They have implemented...like when you type '@'

Android Inside Custom ListView, TextView Weight property not working

纵饮孤独 提交于 2019-12-12 05:12:32
问题 I have a custom listView. The listview data are setting by some textview horizontally for each rows. In main layout I have same number of textView for setting the title of those columns. My problem is, the main layout working fine with the weight property. But the custom value setting layout for listview which contains the textview is not working with the weight property. Main Layout : (Weight property working correctly) <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"