## Two Rectangles intersection

I have two rectangles characterized by 4 values each : Left position X, top position Y, width W and height H: X1, Y1, H1, W1 X2, Y2, H2, W2 Rectangles are not rotated, like so: +——————–> X axis | | (X,Y) (X+W, Y) | +————–+ | | | | | | | | | | … Read more

## How to get round shape in Android [duplicate]

This question already has answers here: How to define a circle shape in an Android XML drawable file? (18 answers) Closed 6 years ago. How would I achieve a round shape in Android, like below, through an Android shape drawable: Answer You need to create a shape drawable in the drawable folder that looks something … Read more

## what does numpy ndarray shape do?

I have a simple question about the .shape function, which confused me a lot. a = np.array([1, 2, 3]) # Create a rank 1 array print(type(a)) # Prints “<class ‘numpy.ndarray’>” print(a.shape) # Prints “(3,)” b = np.array([[1,2,3],[4,5,6]]) # Create a rank 2 array print(b.shape) # Prints “(2, 3)” What did the .shape exactly do? count … Read more

## Drawing multiple shapes with ShapeDrawable in xml with Android

I am currently drawing a number of circles on a canvas in a custom view in code. the circles are static and do not change. I would like to draw them using a ShapeDrawable in xml to help clean up my code. I will have a number of different drawables which the user can select … Read more

## SVG to Android Shape [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more

## Shape drawable as background, a line at the bottom

I am using a drawable as a background of a TextView just to have a divider line below the text. A achivied it with this drawable-xml: <?xml version=”1.0″ encoding=”utf-8″?> <layer-list xmlns:android=”http://schemas.android.com/apk/res/android” > <item> <shape android:shape=”rectangle”> <solid android:color=”#FFDDDDDD” /> <gradient android:angle=”0″ android:startColor=”#FFAAAAAA” android:endColor=”#FFEEEEEE” /> </shape> </item> <item android:bottom=”2dp”> <shape android:shape=”rectangle”> <solid android:color=”#FF000000″ /> </shape> </item> </layer-list> … Read more

## I need to change the stroke color to a user defined color. Nothing to do with the state

I need to change the stroke color from the app. The user is able to change the background color so I need to also let them change the stroke (outline) of the button. As its is already set in the drawable (sample below) I have not found a way to change this. Seems like all … Read more

## Android: Using linear gradient as background looks banded

I’m trying to apply a linear gradient to my ListView. This is the content of my drawable xml: <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android”> <gradient android:startColor=”#3A3C39″ android:endColor=”#181818″ android:angle=”270″ /> <corners android:radius=”0dp” /> </shape> So I apply it to my ListView with: android:background=”@drawable/shape_background_grey” It works but it looks very “banded” on emulator and on a real device … Read more

## How to change shape color dynamically?

I have <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle”> <solid android:color=”#FFFF00″ /> <padding android:left=”7dp” android:top=”7dp” android:right=”7dp” android:bottom=”7dp” /> </shape> <TextView android:background=”@drawable/test” android:layout_height=”45dp” android:layout_width=”100dp” android:text=”Moderate” /> So now I want this shape to change colors based on information I get back from a web service call. So it could be maybe yellow or green or red or … Read more

## How to create a DataFrame of random integers with Pandas?

I know that if I use randn, import pandas as pd import numpy as np df = pd.DataFrame(np.random.randn(100, 4), columns=list(‘ABCD’)) gives me what I am looking for, but with elements from a normal distribution. But what if I just wanted random integers? randint works by providing a range, but not an array like randn does. … Read more