草庐IT

android - 如何从视频文件中获取图像

大家好,我是韩国的开发者。我有一些问题,所以我进入了这个网站。InputStreamis;URLurl=newURL("http://112.216.25.58:8888/VOD_LAUNCHER/media/youtube_sample3.mp4");Uriuri=Uri.parse(url.toURI().toString());is=getContentResolver().openInputStream(uri);Bitmapbitmap=BitmapFactory.decodeStream(is);//Bitmapbitmap=BitmapFactory.decodeFile

android - View 什么时候获得它的边界?

我有一个主要的Activity,上面有TextView。我需要在应用程序启动时执行一些操作。这些操作使用TextView的边界。我尝试覆盖onCreate()、onStart()和onResume()方法,但是TextView's边界总是(0,0)。当TextView获得它的大小时,我如何捕捉瞬间?谢谢大家! 最佳答案 你可以试试onWindowFocusChanged()看看是否有帮助:Thisisthebestindicatorofwhetherthisactivityisvisibletotheuser.Thedefaulti

android为一层图层drawable设置边界

我正在尝试将LayerDrawable用于自定义UI小部件,并使用与其他层不同的边界绘制一层,但它似乎不起作用。本质上,我的代码是这样做的:intleft,top,right,bottom;/*...dosomemath...*/Drawabled=mDrawable.findDrawableByLayerId(R.id.some_specific_layer);d.setBounds(left,top,right,bottom);同时,xml看起来像这样:所以理想情况下,我会在灰色矩形上看到some_drawable,从后面显示的灰色量取决于边界计算的结果。但是我从来没有看到任何灰色

java - 文本呈现在实心矩形上,但不呈现在渐变上

我是Android开发的新手,并尝试在onDraw方法中将按钮呈现给Canvas对象,基本上是在后场上显示文本。这是让我熟悉一些渲染命令的好方法。我可以填充一个实心矩形,然后在其上绘制居中文本,但是当我尝试填充一个渐变矩形,然后在其上绘制文本时,文本不会绘制。代码如下,由各种示例拼凑而成。基本上:DO_PAINT=0,DO_GRADIENT=0->文本渲染DO_PAINT=1,DO_GRADIENT=0->顶部有文本的实心矩形DO_PAINT=0,DO_GRADIENT=1->渐变矩形(无文字)!!!所以我的渐变绘图会干扰我的文本渲染。我猜想我在Paint对象中留下了一些处于不良状态的

android - AndEngine 出现错误 : Supplied pTextureAtlasSource must not exceed bounds of Texture

我是Android游戏的新手,开始使用createTiledFromAsset时遇到问题我遇到问题的代码是@OverridepublicvoidonLoadResources(){mBitmapTextureAtlas=newBitmapTextureAtlas(128,128,TextureOptions.BILINEAR);BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");mPlayerTextureRegion=BitmapTextureAtlasTextureRegionFactory.createT

android - CameraUpdateFactory.newLatLngBounds 一直不工作

我在Android谷歌地图上移动相机时遇到了一些问题。我有这个功能:protectedvoidcentralizeMapToBounds(finalLatLngsouthwest,finalLatLngnortheast,finalLatLngtaxi){finalintpadding=30;Locationloc1=newLocation("");loc1.setLatitude(southwest.latitude);loc1.setLongitude(southwest.longitude);Locationloc2=newLocation("");loc2.setLatitud

android - setCompoundDrawablesWithIntrinsicBounds 无法正常工作

我有一个电子邮件字段作为EditText。我试图在验证为真时在文本字段的末尾添加一个绿色勾号图标,并在验证为假时添加setError。这是我现在正在使用的一段代码:email.setOnFocusChangeListener(newView.OnFocusChangeListener(){@OverridepublicvoidonFocusChange(Viewv,booleanhasFocus){if(!hasFocus){Stringmail=email.getText().toString();if(!android.util.Patterns.EMAIL_ADDRESS.mat

android - 获取文本空间边界

如何测量android中的空间边界?我的意思是,以下内容:Rectbounds=newRect();paint.getTextBounds(String.valueOf(''),0,1,bounds);returnbounds.width();返回0。 最佳答案 解决方案是改用paint.measureText(String.valueOf(''))。 关于android-获取文本空间边界,我们在StackOverflow上找到一个类似的问题: https:/

android - 观看动画不会改变触摸区域

在TranslateAnimation之后,已翻译View上的OnClickListener未翻译。我尝试在自定义LinearLayout中覆盖getHitRect但没有成功。我还尝试使用touchdelegate和在整个互联网上找到的所有其他建议,但都没有成功:)TranslateAnimationopen=newTranslateAnimation(0,displayWidth-ivTimelineWidth,0,0);open.setDuration(1000);open.setFillAfter(true);llMapContent.startAnimation(open);请

android - Canvas.drawVertices(...) 什么都不画

下一个类是一个红色三角形的View:publicclassFreeStyleViewIIextendsView{privatefinalPaintpaint=newPaint();privatefinalint[]colors=newint[]{Color.RED,Color.RED,Color.RED,0xFF000000,0xFF000000,0xFF000000};privatefinalfloat[]verts=newfloat[]{1f/2f*200f,1f/4f*200f,1f/4f*200f,3f/4f*200f,3f/4f*200f,3f/4f*200f};privat