set top corner of shape radius programmatically android
GradientDrawable shape = new GradientDrawable();
shape.setCornerRadius( 8 );
// add some color
// You can add your random color generator here
// and set color
if (i % 2 == 0) {
shape.setColor(Color.RED);
} else {
shape.setColor(Color.BLUE);
}
// now find your view and add background to it
View view = (LinearLayout) findViewById( R.id.my_view );
view.setBackground(shape);
Also in Java:
- remove item from arraylist in java
- java get folder content
- hashmap get value java
- make a commet in java
- generic method lambda java
- int to long java
- java observable to observer stack overflow
- java square a number
- java read file text
- java strin to int
- how to select a element in an arraylist java
- spigot custom mob
- thymeleaf Expression Object dialects
- 2d array java
- how to play a clip of audio in java when needed
- primitive data types in java
- java execute jar from main
- binary to int java
- jframe border
- in java how to convert string to integer
- counting the sequence of character in string java
- read csv java android
- has been compiled by a more recent version of the Java Runtime (class file version 56.0), this version of the Java Runtime only recognizes class file versions up to 55.0
- java get keys from hashmap