Android layout solution -
i trying make layout comparable both phones , tablets. since there many different screen sizes , resolutions wondering best way achieve shown bellow.
bottom banner should retain aspect ratio still fill 100% width of screen. of logo, image , buttons need close possible shown on devices.
can point me proper solution (relative/linear) layout or there different approach?
sorry if question not suitable nut struggling few hours finding best way display correctly. :(
you can create own star view programatically , use background,
public class starlayout extends relativelayout { public starlayout(context context) { super(context); } public starlayout(context context, attributeset attrs) { super(context, attrs); } @suppresslint("newapi") public starlayout(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); } @override protected void ondraw(canvas canvas) { path clippath = new path(); clippath.addpath(star()); canvas.clippath(clippath); canvas.drawcolor(color.magenta); super.ondraw(canvas); } private path star() { path path = new path(); float midx = getwidth()/2; float midy = getheight()/2; path.moveto(midx, midy); path.lineto(midx+190, midy+300); path.lineto(midx, midy+210); path.lineto(midx-190, midy+300); path.lineto(midx-160, midy+90); path.lineto(midx-300, midy-70); path.lineto(midx-100 ,midy-110); path.lineto(midx, midy-300); path.lineto(midx+100, midy-110); path.lineto(midx+300, midy-70); path.lineto(midx+160, midy+90); path.lineto(midx+190, midy+300); return path; }
to use backgroud,
<com.example.starlayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#b4b4b4" >
original source:
http://balvinder788.blogspot.com/2015/01/star-shape-layout-designing-android.html
Comments
Post a Comment