I am trying to attract a complex circle from the other half using the XML description of Android . / P>
There is a limit on the left side of the last circle and there should be no limit on the right side.
Although I am creating two separate boards (with one border, without the other) and merging them but I did not manage to do so?
first_circle.xml
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Size Android: shape = "oval" xmlns: android = "http://schemas.android.com/apk/res/android" & gt; & Lt; Solid Android: Color = "@Android: Color / Holo_Ard_Darar" /> & Lt; / Size & gt;
second_circle.xml
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Size Android: shape = "oval" xmlns: android = "http://schemas.android.com/apk/res/android" & gt; & Lt; Solid Android: Color = "@Android: Color / Black" /> & Lt; Stroke Android: width = "6dp" Android: color = "@ color / lectra_black" /> & Lt; / Size & gt;
final_circle.xml
& lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Layer-list xmlns: android = "http://schemas.android.com/apk/res/android" & gt; & Lt; Item android: top = "0dp" Android: left = "0dp" Android: Below = "0dp" Android: right = "0dp" Android: drawable = "@ drawable / first_circle" & gt; & Lt; / Item & gt; & Lt; Item android: top = "0dp" Android: left = "0dp" Android: bottom = "0dp" Android: right = "0dp" Android: drawable = "@ drawable / second_circle" & gt; & Lt; / Item & gt; & Lt; / Layer-list & gt; I am answering my question: half a circle with the counter, without the other half Circle_grey in drawable XML, counter-black XML, counter-black_clip.axm Layout contains activity_main.xml. circle_grey.xml & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Size Android: shape = "oval" xmlns: android = "http://schemas.android.com/apk/res/android" & gt; & Lt; Solid Android: Color = "#A0A0A0" /> & Lt; / Size & gt;
counter_black.xml
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Size Android: shape = "oval" xmlns: android = "http://schemas.android.com/apk/res/android" & gt; & Lt; Size Android: width = "80sp" Android: height = "80dp" /> & Lt; Stroke Android: width = "4dp" Android: color = "# 000000" /> & Lt; / Size & gt;
counter_black_clip.xml
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Clip xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Dragon = "@ Drawable / Counter-Black" Android: Clip Orientation = "Horizontal" Android: gravity = "left" / & Gt;
activity_main.xml
& lt; Relative layout xmlns: android = "http://schemas.android.com/apk/ res/Android" xmlns: tool = "http://schemas.android.com/tools" Android: layout_width = "match_parent" Android: layout_height = "Match_parent" tool: Reference = "MainActivity">. & Lt; LinearLayout Android: layout_width = "80dp" Android: layout_height = "80dp" Android: Background = "@ drawable / circle_grey" Android: Orientation = "Horizontal" Android: layout_marginTop = "10dp" Android: layout_marginBottom = "10dp" Android: Layout_marginRight = "10dp" Android: layout_margin lift = "10dp" & gt; & Lt; Android: background = "@ drawable / counter_black_clip" Android: layout = "match_parent" Android: layout_height = "match_parent" Android: id = "@ + id / layout_half_cercle" Android: weightSum = "7" Android: Background = "Horizontal" /> & Lt; / LinearLayout & gt; & Lt; / RelativeLayout & gt;
activity_main.java
package app.test.com.myapplication; Import android.graphics.drawable.ClipDrawable; Import android.support.v7.app.ActionBarActivity; Importroid.os.Bundle; Import android.widget.LinearLayout; Public Squared MainActivity ActionBarActivity {@Override Protected Zero OnCreate (bundled savedInstanceState) {super.onCreate (savedInstanceState) extends; SetContentView (R.layout.activity_main); LinearLayout layoutDate = (LinearLayout) FindById (R.id.layout_half_cercle); Clip drawable drawable = (clip dual) layout data. Getbackground (); Drawable.setLevel (drawable.getLevel (+5000); }}
No comments:
Post a Comment