custom-controls

Custom Fonts and Custom Textview on Android

我的未来我决定 提交于 2019-11-27 08:04:26
From an application I need to develop, I've received a specific font that has many files like FontName-Regular, FontName-Bold , FontName-it . I need to use it in all the textviews in the application. First I thought it was an easy task. Look over SO and found a very nice thread: here So first I did like: public static void overrideFonts(final Context context, final View v) { try { if (v instanceof ViewGroup) { ViewGroup vg = (ViewGroup) v; for (int i = 0; i < vg.getChildCount(); i++) { View child = vg.getChildAt(i); overrideFonts(context, child); } } else if (v instanceof TextView) { (

Custom View not responding to touches

℡╲_俬逩灬. 提交于 2019-11-27 07:57:12
问题 I've created a custom view which should change it's background image when pressed, highlighted or disabled. The app runs but the button doesn't change it's background. here's my code: public class CustomImageButton extends View { public CustomImageButton(Context context) { super(context); setFocusable(true); setClickable(true); } public CustomImageButton(Context context, AttributeSet attrs) { super(context, attrs); setFocusable(true); setClickable(true); } public CustomImageButton(Context

Custom Shaped Button in WPF [closed]

心已入冬 提交于 2019-11-27 07:45:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I have a requirement of creating a button which takes the shapes as displayed in the picture: Can anyone please help me? Thanks in advance! 回答1: You could use a ControlTemplate to achieve that: <Style x:Key="ButtonStyle" TargetType="{x:Type Button}"> <Setter Property="Background" Value="Black"/> <Setter Property

Image flickers on repaint()

房东的猫 提交于 2019-11-27 07:24:12
问题 I figured out the solution for my previous question which landed me into new problem. In the following code im moving an image around a JFrame using arrow keys. but every time i press an arrow key the image seems to flicker which is quite noticeable when a key is pressed continuously. import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing

How do I make reorder control of UITableViewCell in left side?

偶尔善良 提交于 2019-11-27 07:18:45
I am doing a news reader app and I want to make it so that the user can choose show/hide news categories (such as top news, business, technology, sports, etc) and reorder them like the BBC news app in Android. See the picture below: My question is: How do I make reorder control in left side of cell? (Its default position is in the right side of the cell in edit mode) I have a checkbox custom control. How do I put it in right side of the cell? Answer [If you're not using any accessories (detail disclosure, &c)] (0) I assume you have your tables set up, &c. (1) This solution only works if your

Custom button template in WPF

放肆的年华 提交于 2019-11-27 07:01:17
I want to create a simple button template with an image and text inside it. But I want to keep the System button's look and feel. How do I create it, step by step? P.S.: I have already tried it with CustomControl in WPF and BasedOn property. You can do this easily with a style and attached property: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ap="clr-namespace:MyProject.Namespace.Path.To.ButtonProperties"> ... <Style x:Key="ImageButton" TargetType="Button"> <Setter Property="ContentTemplate">

Animated Glow Effect for Button - C# Windows Forms

左心房为你撑大大i 提交于 2019-11-27 06:30:07
问题 I want to apply animation to my button when pressing button. In WPF I can use Storyboard with triggers to create animation. Here is an example: <Storyboard x:Key="AniOpacityDelay"> <DoubleAnimation Storyboard.TargetName="background" Storyboard.TargetProperty="Opacity" AutoReverse="True" To="0.65" Duration="0:0:0.2"/> </Storyboard> and: <ColorAnimationUsingKeyFrames Storyboard.TargetName="Itemcont" Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">

Button template with image and text in wpf

大憨熊 提交于 2019-11-27 05:49:46
问题 I want to create buttons with images and text inside. For example, i would use different images and text for buttons like 'Browse folders' and 'Import'. One of the options would be to use a template. I had a look at simliar question Creating an image+text button with a control template? But is there any way by which i can bind the source of image without using a dependency property or any other class? Thanks 回答1: No. What would you bind the Image.Source to? You need a DependencyProperty for

Show Transparent Loading Spinner above other Controls

六眼飞鱼酱① 提交于 2019-11-27 05:13:35
I am working in a spinner control. I want the control to support transparent backcolor. When the arc is drawn, there is a blank space in the middle, I want that space to be truly transparent, so that I could put another control behind it and it would not be covered by the spinner. I tried overriding the CreateParams void. Also I set the style to support TransparentColor. Tried overriding OnPaintBackground void, but I cannot achieve the real transparent backcolor. So, what can you suggest me to do? Reza Aghaei To make a transparent layer, you should override painting of the control and draw the

How to use standard attribute android:text in my custom view?

拈花ヽ惹草 提交于 2019-11-27 04:16:09
问题 I wrote a custom view that extends RelativeLayout . My view has text, so I want to use the standard android:text without the need to specify a <declare-styleable> and without using a custom namespace xmlns:xxx every time I use my custom view. this is the xml where I use my custom view: <my.app.StatusBar android:id="@+id/statusBar" android:text="this is the title"/> How can I get the attribute value? I think I can get the android:text attribute with TypedArray a = context