android

How to change toolbar back button icon in android material components

坚强是说给别人听的谎言 提交于 2021-02-19 05:11:51
问题 I would like to change the default navigate up icon (back button icon) to my custom icon. I not using a drawer, just a simple toolbar and material components Is this possible? 回答1: If you are using a Toolbar to change the icon just use: Toolbar toolbar = findViewById(R.id.xxx); toolbar.setNavigationIcon(R.drawable.xxxx4); setSupportActionBar(toolbar); If you are using the ActionBar you can use: getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeAsUpIndicator(R

How to change toolbar back button icon in android material components

被刻印的时光 ゝ 提交于 2021-02-19 05:10:07
问题 I would like to change the default navigate up icon (back button icon) to my custom icon. I not using a drawer, just a simple toolbar and material components Is this possible? 回答1: If you are using a Toolbar to change the icon just use: Toolbar toolbar = findViewById(R.id.xxx); toolbar.setNavigationIcon(R.drawable.xxxx4); setSupportActionBar(toolbar); If you are using the ActionBar you can use: getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeAsUpIndicator(R

Animation for action bar show action

為{幸葍}努か 提交于 2021-02-19 05:09:22
问题 I'm using android 4.2 with appCompat of the latest version. I've implemented showing and hiding my action bar with these methods: final ActionBar actionBar = getSupportActionBar(); actionBar.hide(); actionBar.show(); When action bar is being hide, it does so with smooth animation gradually sliding up. However, when I show it it appears on the screen almost instantly, almost without smooth animation sliding down. Is there any way I can configure it to show smoothly as it happens with hiding it

GradientDrawable setColors for older API levels

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-19 04:51:12
问题 Is it possible to set the colors array of a gradient in a shape on a lower API level than API 16 (JellyBean)? I'm currently using: GradientDrawable gd = (GradientDrawable)this.getBackground(); int[] colors = {0xFFFF0000, 0xFFCC0099}; gd.setColors(colors); Which works great, but I am hoping to support API Level 8 (Froyo) or 10 (Gingerbread v2). 回答1: I don't think there is an easy way of doing this, so here's what I'd suggest: Create a new GradientDrawable based on the parameters of the old one

Screen recording within android using libgdx or not

点点圈 提交于 2021-02-19 04:48:07
问题 I managed to do this by taking a series of screenshots and convert them to video using ffmpeg (ffmpeg compiled for android and include all *so to asserts, copy them all to to data/data/my.package/ and execute ffmpeg from there) But the main problem is the taking screenshots have big impact on screen rendering, it freezes a while (~0.1sec) when the app is executing this line of code: Gdx.gl.glReadPixels(x, y, w, h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, pixels); I tried to take screenshots from

ESC/POS thermal printer, how to center a bitmap image in Android?

蓝咒 提交于 2021-02-19 04:41:32
问题 I'm writing a simple app in Android to print through a ESC/POS thermal printer. I've just a problem. The app generate a QR Code (with zxing library), convert it in a bitmap and send it to the printer. The printer print it, but I'm not able to center it. Instead with text I have no positioning issue. This is the code to print the text and the QR. byte[] INIT = {27, 64}; byte[] FEED_LINE = {10}; byte[] SELECT_FONT_A = {27, 33, 0}; byte[] FONT_B = {0x1B, 0x4D, 0x01}; byte[] ALLINEA_SX = {0x1B,

ESC/POS thermal printer, how to center a bitmap image in Android?

守給你的承諾、 提交于 2021-02-19 04:41:10
问题 I'm writing a simple app in Android to print through a ESC/POS thermal printer. I've just a problem. The app generate a QR Code (with zxing library), convert it in a bitmap and send it to the printer. The printer print it, but I'm not able to center it. Instead with text I have no positioning issue. This is the code to print the text and the QR. byte[] INIT = {27, 64}; byte[] FEED_LINE = {10}; byte[] SELECT_FONT_A = {27, 33, 0}; byte[] FONT_B = {0x1B, 0x4D, 0x01}; byte[] ALLINEA_SX = {0x1B,

certificate unknown(46)

寵の児 提交于 2021-02-19 04:33:10
因为腾讯云的网站备案迟迟没有批下来,因此使用了朋友在阿里云的域名yk,我则申请了一台阿里云服务器,并将域名解析映射至该服务器。SSL证书则是在腾讯云上申请的,使用了Apache文件夹中的文件,放置在cowboy的priv/ssl目录下,1_root_bundle为根证书,2_yk.crt为网站证书,3_yk.key为密钥。一切布置妥当后,在PC的chrome、android的chrome、苹果手机的微信等环境中均可以正常访问,但是在android的微信中访问时服务器报如下错误: client alert Fatal: unknown certificate(46) RFC中的解释是: certificate_unknown Some other (unspecified) issue arose in processing the certificate, rendering it unacceptable. 搜索到一些信息,如: https://cweiske.de/tagebuch/https-client-cert-unknown.htm 也使用wireshark抓包排查了流程,但是由于对SSL不是非常了解,始终没有找到进一步的原因和方向。后来向一些朋友请教,整理了思路。对于这种问题,首先要到SSL测试网站上测试具体的问题: https://www.myssl.cn

Rest API - how add custom headers?

那年仲夏 提交于 2021-02-19 04:33:05
问题 I want to make POST request with custom header. I can't find information how to do this using AA Rest API - https://github.com/excilys/androidannotations/wiki/Rest%20API . Should I use ClientHttpRequestInterceptor, which is used for authenticated requests? https://github.com/excilys/androidannotations/wiki/Authenticated-Rest-Client Thanks for any help! 回答1: There is currently an open issue for this : https://github.com/excilys/androidannotations/issues/323 For now, the only way to do this is

PdfRendering zoom on page

三世轮回 提交于 2021-02-19 04:17:55
问题 I'm working on a project where I need to display PDF content inside our application. I'm trying to use PdfRenderer of Android API. For now, I'm able to show a pdf page as bitmap and move between all other pages. But I don't understand how to implement zoom on a page. I mean I know how to zoom an image, but for pdf it needs to be recalculated at every zoom level (such as tile ?). On zoom I need to recalculate Bitmap with correct Rect and Matrix I guess, that's the point I'm missing. Does some