shape

Defining XML Parent Style of Gradient / Shape / Corners

坚强是说给别人听的谎言 提交于 2019-11-30 09:12:06
How can I define an easily reusable base shape (or gradient, or corners) in XML? I have a dozen or so drawable gradients that will be the same other than the start and end colors. I was hoping to define the identical stuff somewhere else and have an XML file for each different gradient that only defined the start and end colors. Is that possible? This is the base: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient xmlns:android="http://schemas.android.com/apk/res/android" android:type="linear" android

Android Drawable: Specifying shape width in percent in the XML file?

荒凉一梦 提交于 2019-11-30 07:19:49
问题 I'm trying to create a simple Drawable that I want to set as the background for a view (using setBackgroundDrawable ). I simply want to divide the background of the drawable into 2 equal rectangles (50% - 50%), the first want filled with black, the second with white: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/back_color_1"> <shape android:shape="rectangle"> <solid android:color="#000000" /> </shape> <

How to create ring shape drawable in android?

蹲街弑〆低调 提交于 2019-11-30 04:43:33
with this code I get just a border: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:innerRadius="15dp" android:thickness="2dp" android:useLevel="false"> <solid android:color="#4d4d4d" /> </shape> how can I make a ring shape like below image : 2dp outer ring with a 2dp gap: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:top="4dp" android:right="4dp" android:bottom="4dp" android:left="4dp"> <shape android:shape="oval"> <solid android:color="#4d4d4d" /> </shape> </item>

Drawing top border on a shape on Android

筅森魡賤 提交于 2019-11-30 03:19:19
I'm creating a custom progress bar (positioned under a WebView ) and what I would like to draw is a 1dp-wide line between the WebView and the ProgressBar . I'm modifying existing drawable, namely progress_horizontal.xml , and tried something like this: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> (...) <item> <shape android:shape="line"> <stroke android:width="1dp" android:color="#FF000000" /> </shape> </item> </layer-list> This line however is vertically centered but I want it to be drawn on top of the drawable. The only idea I

Delphi7, make a shape jump when pressing Up key

允我心安 提交于 2019-11-29 23:59:10
问题 I'd like to make a shape jump when the player presses the UP key, so the best i could think of is this, but the method i used is terrible and problematic: (shape coordinates: shape1.top:=432;) procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin case key of vk_up: shape1.top:=shape1.top-40 //so that it jumps to 392 end; end; And now this timer: procedure TForm1.Timer1Timer(Sender: TObject); begin timer1.interval:=300 if shape1.Top<400 then //if shape1.top

Algorithm for shape calculation (Ellipse)

我只是一个虾纸丫 提交于 2019-11-29 21:32:48
问题 I have n circles that must be perfectly surrounding an ellipse as shown in the picture here : In this picture I need to find out the position of each circle around the ellipse, and also be able to calculate the ellipse that will fit perfectly inside those surrounding circles. The information i know is the radius of each circles (all same), and the number of circles. Hopefully this time the post is clear. Thanks for your help. Please let me know if you need more explanation. 回答1: OK as i

Word VSTO - Change the absolute positions' type?

岁酱吖の 提交于 2019-11-29 18:07:32
I use the following VB.NET (VSTO) code to add a shape in MS-Word, Dim app As Word.Application = Globals.ThisAddIn.Application Dim doc As Word.Document = app.ActiveDocument Dim left As Single = CSng(Convert.ToDouble(app.Selection.Information(Word.WdInformation.wdHorizontalPositionRelativeToPage))) Dim top As Single = CSng(Convert.ToDouble(app.Selection.Information(Word.WdInformation.wdVerticalPositionRelativeToPage))) Dim shape As Word.Shape = doc.Shapes.AddShape(1, left, top, 225.1F, 224.5F) shape.Fill.BackColor.RGB = ColorTranslator.ToOle(Color.Transparent) shape.Fill.Visible = Microsoft

Apache POI XWPF adding shapes to header

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 16:39:49
I'm trying to add some shapes and a logo-file into the header of my word docx document. Adding a picture works for me, but i didn't find any solution how to add a shape. can anyone help me? String imgFile="logo.png"; XWPFDocument document = new XWPFDocument(new FileInputStream("myfile.docx")); CTSectPr sectPr = document.getDocument().getBody().addNewSectPr(); XWPFHeaderFooterPolicy headerFooterPolicy = new XWPFHeaderFooterPolicy(document, sectPr); XWPFHeader header = headerFooterPolicy.createHeader(XWPFHeaderFooterPolicy.DEFAULT); XWPFParagraph paragraph = header.getParagraphArray(0);

Flipping shape (not image)

℡╲_俬逩灬. 提交于 2019-11-29 16:09:51
Solved: Thanks @MadProgrammer I replaced g2.rotate(Math.toRadians(180.0)); by g2.scale(1, -1); thanks^^ I wrote program to show Digital Clock with mirror (Vertical Flip) This is my code import java.awt.*; import java.awt.font.GlyphVector; import javax.swing.*; import java.util.*; public class DigitalClock extends JFrame implements Runnable { /** * @author HASSAN */ Thread runner; // declare global objects Font clockFont; Shape mirror; public DigitalClock() { super("Digital Clock - Hassan Sharaf 12MCMB33"); setSize(600, 500); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true);

Change shape of JProgressBar [duplicate]

感情迁移 提交于 2019-11-29 15:46:12
This question already has an answer here: Nice looking progress bar in java 2 answers Can't change JProgressBar color in Mac OS look and feel 1 answer I am new to Java but needs to know that if it is possible for a developer so that he/she can change the shape of the JProgressBar . I mean suppose in my case I want to change the shape so that it looks like a circle or something else? Though I just want it to be changed from a bar shape to an arc shape or you can say i want to change the bar shape into any other shape. My progress bar may look like a curve other than a bar shape. I want to add a