custom-view

Android NullPointerException in custom view access

落花浮王杯 提交于 2019-12-13 00:53:44
问题 I have created a custom view name StepView . Here is the code for StepView. public class StepView extends LinearLayout { private Context cont; private LinearLayout stepHolder; public StepView(Context context, AttributeSet attrs) { super(context); // TODO Auto-generated constructor stub LayoutInflater.from(context).inflate(R.layout.stepview, this, true); stepHolder = (LinearLayout) findViewById(R.id.stepHolder); cont = context; } public void addStep(String title, int drawableId, View

Creating custom view from xml

ⅰ亾dé卋堺 提交于 2019-12-12 20:28:19
问题 I would like to add the same horizontal scrollable row of buttons like so <HorizontalScrollView [...]> <LinearLayout [...] android:orientation="horizontal"> <Button android:id="@+id/btn1" [..] /> <Button [..] /> [...] </LinearLayout> </HorizontalScrollView> (toolbar.xml) to the bottom of every activity in my application. Rather than have to specify the click listeners for each button in every single activity, I'd like to be able to do all of that in one place and then just import the control

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

Custom View in UIAlertController

醉酒当歌 提交于 2019-12-12 09:53:17
问题 I am trying to put a custom view inside a UIAlertController . I'm running into some odd issues with the sizing of the custom view. I want the custom view to span the width of the UIAlertController , whatever that might be. I'm using CGRectGetWidth(alertController.view.bounds) to get the width of the alert controller. However, this seems instead to be returning the width of the entire view. using view.frame does not make a difference. UIAlertController *alertController = [UIAlertController

How are you supposed to use a ShapeDrawable with a PathShape to draw a line on a custom View?

你说的曾经没有我的故事 提交于 2019-12-12 08:12:20
问题 I am attempting to draw a line in a custom View . Here I've created a simple Path with just a single segment, created a PathShape from that, and finally stuck that into a ShapeDrawable with the intention of using that to draw on the Canvas inside onDraw() . However, this does not work. See my example, here. package com.example.test; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import

Setting up the style or typeface of a custom view which contains text, like default TextView?

大城市里の小女人 提交于 2019-12-11 16:32:55
问题 I`m implementing a custom view which contains text, and the text will be drawn in onDraw. My problem is, I wish my text will looks like those in the TextView objects, but I`m not quit familiar with setting up the style and typeface. The text finally drawn with my fresh new Paint object, looks different from TextView: The lines looks thinner and seems bitten by some insects... - -b. I wish my text will be drawn just like those TextView objects. Plz help! ==================== The problem in

setText in custom view

主宰稳场 提交于 2019-12-11 10:35:41
问题 I have created a custom class from a tutorial online. It works fine, but what I want to do is make it so that I can set the text of the view, just like I would any other view. How is that accomplished. Here is the xml for the custom view <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center"> <ImageView android:id="@+id/file_image_holder" android

MonkeyTalk : Verify custom UITableViewCell Label text without select the cell

*爱你&永不变心* 提交于 2019-12-11 06:06:12
问题 I have an iPhone application that has a search box and UITableView with custom UITableViewCells. This Table Loaded with search results after user enter a search word and tap search. I need to test the search results with MonkeyTalk. (using MonkeyTalk script or JavaScript version of it). I want to retrieve/verify that 2nd Label of first CustomUITableViewCell contains the search text without selecting the cell. So far I'm able to get number of items of the each table section using var count =

fading edges working only on top and left

倖福魔咒の 提交于 2019-12-10 18:48:08
问题 I made a custom ImageView that supports basic scrolling through calls to View.scrollBy() in a GestureDetector . I wanted to add some feedback on the reaching of scrolling bounds so I enabled fading with: setVerticalFadingEdgeEnabled(true); setHorizontalFadingEdgeEnabled(true); but the fading works as I expected only on top and left edges, while bottom and right ones don't fade. I'm sure those edges aren't off screen because the view is set to fill_parent in height and width. So what's wrong?

How to create a custom Pulldown in the Honeycomb ActionBar?

。_饼干妹妹 提交于 2019-12-10 17:34:55
问题 I would like to add a custom pulldown menu to the actionbar in my project similar to the one that can be found in the google books app (screen). In this case it represents the complete table of contents of the book. I tried to follow the guide from the developer site where there is an example with a SpinnerAdapter. But when i use a custom Layout (in my case a RelativeLayout with two TextViews in it) i get an Exception that saying "ArrayAdapter requires the resource ID to be a TextView". So i