android-custom-view

Semi Circular Progress bar Android - drawing semi circle

筅森魡賤 提交于 2019-12-21 22:33:25
问题 I created a semi circular progress bar using this devadvance\circularSeekBar and it looks like this when I select that custom view from the palette. . In this I have two Relative layouts with weights. Weight of the layout containing the progress bar is 2 and the bottom one has weight of 3. And layout width and height of the progress bar is set to wrap content. So my issue is why does the progress bar look like this when selected from palette? Is it that the canvas size takes the perfect

Custom camera app in android problems - rotation 270, stretched capture view and not getting all functions

我的梦境 提交于 2019-12-21 21:37:20
问题 I got the help from code https://github.com/josnidhin/Android-Camera-Example But facing some problems like: How to add functionalities of auto focus and flash. - solved in last edited code The when screen orientation is 270 so real view shows 180 degree rotated. Capture view is showing stretched. The CODE from where i called the custom camera class Camera cam = Camera.open(); if (null == cam) { // no camera exists Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images

Change Color TabSelector on v4 ViewPager

梦想与她 提交于 2019-12-21 09:16:43
问题 Is it possible to change color of selected tab on v4 ViewPager? I need to use v4 ViewPager, but I don't find any source to customize it. Just to clarify I need to change the blue color to another one: 回答1: This is the tab indicator. You can change its color by applying different styles. Use Action Bar Style Generator, generate 9patch png files (tab_selected, tab_selected_focused etc.) and add these files + styles to your project. Another approach -> How to change the current tab highlighter

Usability of BoringLayout

爷,独闯天下 提交于 2019-12-21 04:53:16
问题 I'm writing a custom layout that will manage text. Before I started implementing the ViewGroup#onMeasure() method I started to dig the EditText source code, specifically at the EditText#onMeasure() method. So I came across the BoringLayout. I read the docs but I didn't find much explanation on it and how to use it in an actual custom implementation. Then my question is how can I use it the right way and when it is really needed. 回答1: BoringLayout is used to draw text on a view. It is called

Calling onDraw() method of a custom View in Android

£可爱£侵袭症+ 提交于 2019-12-21 03:56:22
问题 I have created a CustomView for Calendar. I have an onDraw method to draw the text in the calendar. I want to change the color of the day Text when i click on it. How can i achieve it? CalendarView.java : package com.example.calendar_module; import java.util.Calendar; import android.app.ActionBar.LayoutParams; import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Rect; import android

Showing custom font or View in preview section of Android Studio XML

本小妞迷上赌 提交于 2019-12-21 02:57:15
问题 Is there any way to view custom fonts/views in the preview section of Android Studio? I have used font-awesome as a custom typeface to show microphone icon in my app. Everything is working fine. But as we all know the preview section cannot load custom views. Is there any plugin or hack to see the custom views in the preview window while coding? This is what I am loading on my app: This is what I see in the preview section: 回答1: To make FontAwesome icons visible in Android Studio XML designer

Do I need to call back super.onDraw() in a custom view?

筅森魡賤 提交于 2019-12-20 17:35:47
问题 I'm not too clear about this and neither are the docs. When I'm creating a custom view, I override like so: @Override public void onDraw(Canvas canvas) { super.onDraw(canvas); //more code here... } My question is whether it's necessary to call super.onDraw(canvas); . The code seems to work fine without it, but I want to be sure that it's okay to leave it out. So is it necessary? 回答1: If you want it to call the superclass onDraw method (think TextView or KeyboardView rather than a generic View

Android nine patch - allow only a specific area of a background drawable to stretch

我怕爱的太早我们不能终老 提交于 2019-12-20 15:10:24
问题 How does one go about creating a View that has boundaries with triangular perforations ? I've been using background drawables to achieve this so far. That works when the dimensions of the View are fixed. Now I have a situation where the height of the View is not constant, so I need to have the height variable on the fly. I can't use a background drawable with a fixed height anymore. Here is the original background drawable: And this is what the final View needs to look like: Another way of

Android nine patch - allow only a specific area of a background drawable to stretch

无人久伴 提交于 2019-12-20 15:09:21
问题 How does one go about creating a View that has boundaries with triangular perforations ? I've been using background drawables to achieve this so far. That works when the dimensions of the View are fixed. Now I have a situation where the height of the View is not constant, so I need to have the height variable on the fly. I can't use a background drawable with a fixed height anymore. Here is the original background drawable: And this is what the final View needs to look like: Another way of

Setting textSize in custom view results in huge text

时间秒杀一切 提交于 2019-12-20 11:02:07
问题 I'm calling the following in the constructor of my custom view: private void style(Resources.Theme theme, AttributeSet attrs) { TypedArray a = theme.obtainStyledAttributes( attrs, R.styleable.StackedTextView, 0, 0); try { DebugTool.assertTrue(holdr != null, "View holder has not been properly intialized."); String line1 = a.getString(R.styleable.StackedTextView_line1); setLine1(line1); String line2 = a.getString(R.styleable.StackedTextView_line2); setLine2(line2); line1Size = a.getDimension(R