ondraw

Draw a text on a circle path in android

喜夏-厌秋 提交于 2019-12-21 14:58:28
问题 I need to draw a text on a circle path. I have tried the drawTextOnPath() method. But for texts like "fertile window" in the image attched, the text rotates and is not readable. Code I have used : customPath2.addArc(mCircleRectF, 30F, 64.28F); customPaint2.setAntiAlias(true); customPaint2.setDither(true); customPaint2.setStrokeWidth(mCircleStrokeWidth); customPaint2.setColor(Color.parseColor("#93BE66")); customPaint2.setStyle(Paint.Style.STROKE); customPaint2.setStrokeCap(Paint.Cap.ROUND);

Draw overlay (HUD) on Android VideoView?

孤者浪人 提交于 2019-12-21 12:00:15
问题 I have a custom view that draws HUD : Here is my layout: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <VideoView android:id="@+id/videoView1" android:layout_gravity="center" android:layout_width="match_parent" android:layout_height="wrap_content" /> <com.widgets.HUD android:id="@+id/hud" android:layout_width="fill_parent"

Efficient 2D drawing in Android

妖精的绣舞 提交于 2019-12-20 09:25:11
问题 I have searched for quite a few hours and have not been able to find a concise definite andswer to my question. I have an application where I need to draw a sports field (including all pitch lines) to the screen. So far, I have extended the SurfaceView and pretty much copied the rest of the LunarLander demo as well. All the data the application requires to draw the pitch to the correct dimensions is being received from a socket which works fine too. However, at the minute in the onDraw()

Android canvas - Draw a hole

橙三吉。 提交于 2019-12-19 09:07:47
问题 Is it possible to realize the following picture in Android with canvas? I want to have a hole and not only a Circle over the red layer which is yellow colored. I tried this (and failed) with the following Code in my onDraw() -Method: canvas.drawBitmap(yellow, 0, 0, paint); canvas.drawBitmap(red, 0, 200, paint); Paint p = new Paint(); p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); canvas.drawCircle(300, 300, radius, p); But when I use this code, it makes a hole through both

Android Multiple SurfaceViews

人盡茶涼 提交于 2019-12-17 08:55:08
问题 I'm trying to work with 3 SurfaceViews on one screen, one on top half (BoardView), one on bottom half (StatusView), and the last one as an extra layer above the top half (TileView) (see main.xml). I created a class MySurfaceView, which is extended by BoardView, StatusView and TileView. I've got multiple problems with this. Let me first give the code. main.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width

View in Android taking the whole screen- how to tell the canvas to respect the limits of the view?

你离开我真会死。 提交于 2019-12-14 02:32:00
问题 EDIT: OK, so I've extended the lenght and the width of the view to a big part of the screen I can assume that the onDraw() method is NOT TAKING the limits of the view, because it goes through all the screen as I can suppose. So the question now would be how to tell the canvas to respect the limits of the view? Any ideas, maybe forcing some parameters? END OF EDIT I have implemented some code for drawing a custom view, but the canvas is blank. I am sure it is running, because I have added log

Ondraw for a custom view is looping infinitely android

浪尽此生 提交于 2019-12-14 00:53:49
问题 OnDraw function for my custom View is being called infinitely and is looping !! What could be possible reason?? Here is my custom view:- public class Balls extends View{ private static final String TAG = "BallsView"; private int mMode = READY; public static final int PAUSE = 0; public static final int READY = 1; public static final int RUNNING = 2; public static final int LOSE = 3; private final Paint mPaint = new Paint(); private double mUx = 0.1; private double mUy = 2; private double mVy;

Custom Button background is being drawn wrong (sometimes)

ε祈祈猫儿з 提交于 2019-12-13 20:52:32
问题 I have this custom button, which does not draw himself and has no child views. Right after app launch it looks like this: At this point I don't know what code and details might be relevant for posting here. The fact is after the app changes state the button checks whether to stay VISIBLE or go INVISIBLE . It remains VISIBLE . It calls setVisibility(View.VISIBLE) and after that, when the screen shows again, it looks like this: If I click the button it returns to be fine with its original

Circle shape for ViewPager

强颜欢笑 提交于 2019-12-13 19:07:08
问题 Hi i have a relative layout with a viewpager. <RelativeLayout android:id="@+id/bubble_circle" android:layout_width="200px" android:layout_height="200px" android:layout_centerHorizontal="true" android:background="@drawable/circle"> <android.support.v4.view.ViewPager android:id="@+id/pager" android:overScrollMode="never" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/transparent"/> </RelativeLayout>> I want that this view pager has a

Android: Displaying Bitmap

笑着哭i 提交于 2019-12-13 08:15:21
问题 I kind of asked this project before, but I have come across new problems and new ideas I want to share. I am trying to draw a multitude of the same graphic randomly spaced. Here is the first activity code that transitions to the second activity code: package com.category.tap; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.ImageButton; public class TitleActivity extends Activity {