Posts

Showing posts with the label Xml

Are There Any Free Xml Diff/Merge Tools Available?

Image
Answer : Have a look at at File comparison tools, from which I am using WinMerge. It has an ability to compare XML documents (you may wish to enable DisplayXMLFiles prefilter). DisplayXMLFiles.dll - This plugin pretty-prints XML files nicely by inserting tabs and line breaks. This is useful for XML files that do not have line returns in convenient locations. See also my feature comparison table. I wrote and released a Windows application that specifically solves the problem of comparing and merging XML files. Project: Merge can perform two and three way comparisons and merges of any XML file (where two of the files are considered to be independent revisions of a common base file). You can instruct it to identify elements within the input files by attribute values, or the content of child elements, among other things. It is fully controllable via the command line and can also generate text reports containing the differences between the files. There are a few Java-bas...

Android Shape: Circle With Cross(plus)

Answer : I accomplished something similar (a solid circle with a white plus in the middle) using 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="oval"> <solid android:color="@color/accent"/> </shape> </item> <item> <shape android:shape="line"> <stroke android:width="5dp" android:color="@android:color/white" /> </shape> </item> <item> <rotate android:fromDegrees="90" android:pivotX="50%" android:pivotY="50%" android:toDegrees="-90"> <shape android:shape="line"> <stroke android:width="5dp...

Android Spinner Dropdown Arrow Not Displaying

Answer : This works for me, much simpler as well: <Spinner android:id="@+id/spinner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:theme="@style/ThemeOverlay.AppCompat.Light" android:spinnerMode="dropdown" /> And in your class file: spinner = (Spinner) view.findViewById(R.id.spinner); ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.spinner_data, android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); Hope this helps ;) Try this one: <Spinner android:id="@+id/spinnPhoneTypes" android:layout_width="0dp" style="@android:style/Widget.Spinner.DropDown" android:layout_height="@dimen/thirtyFive" android:layout_marginLeft="10dp" android:layout_weight="1...

Android Bitmap Image Size In XML

Answer : Only API 23 or later Just use <item android:width="200dp" android:height="200dp" android:drawable="@drawable/splash_background" android:gravity="center" /> instead <item android:left="200dp" android:right="200dp"> <bitmap android:src="@drawable/splash_background" android:gravity="center" /> </item> Although there is no width and height parameters for bitmap, you can set bitmap size using gravity and item width/height. <item android:width="230dp" android:height="70dp"> <bitmap android:gravity="fill_horizontal|fill_vertical" android:src="@drawable/screen" /> </item> You can set item width and height and scale bitmap inside of it using gravity. I know this is old question but maybe someone will find it useful. WARNING: As already ...

Android: TextColor Of Disabled Button In Selector Not Showing?

Answer : You need to also create a ColorStateList for text colors identifying different states. Do the following: Create another XML file in res\color named something like text_color.xml . <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- disabled state --> <item android:state_enabled="false" android:color="#9D9FA2" /> <item android:color="#000"/> </selector> In your style.xml , put a reference to that text_color.xml file as follows: <style name="buttonStyle" parent="@android:style/Widget.Button"> <item name="android:textStyle">bold</item> <item name="android:textColor">@color/text_color</item> <item name="android:textSize">18sp</item> </style> This should resolve your issue. 1.Create a color folder ...

Android - Resource Linking Failed / Failed Linking References

Image
Answer : Solution 1: Set your compileSdkVersion to 28 and let Android Studio download the needed files. If you already targetting this version, you could try cleaning your project and sync your gradle files. In my case, I made two custom backgrounds which were not recognised. I removed the <?xml version="1.0" encoding="utf-8"?> tag from the top of those two XML resources file. This worked for me, after trying many solutions from the community. Errors with XML files are quite hard to figure out. They even trickle their impact down to Java files.

Access #text Property Of XMLAttribute In Powershell

Answer : Besides #text , you can also access XmlAttribute 's value via Value property : $attr = $xml.SelectSingleNode("//obj/indexlist/index[@name='DATE']/@value") #print old value $attr.Value #update attribute value $attr.Value = "new value" #print new value $attr.Value Note that Value in $attr.Value is property name of XmlAttribute . It doesn't affected by the fact that the attribute in your XML named value . Don't select the attribute, select the node. The attributes of the node will be represented as properties and can be modified as such: $node = $xml.SelectSingleNode("//obj/indexlist/index[@name='DATE']") $node.value = 'foo' Use a loop if you need to modify several nodes: $nodes = $xml.SelectNodes("//obj/indexlist/index[@name='DATE']") foreach ($node in $nodes) { $node.value = 'foo' }

Android Item Size In Layer-list

Answer : I found solution, but I expected better way. Here is final code: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:endColor="#000004" android:gradientRadius="1000" android:startColor="#1f3371" android:type="radial" > </gradient> </shape> </item> <item> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/texture_5" android:tileMode="repeat" /> </item> <item android:drawable="@drawable/logo" android:bottom="214dp" android:top="214dp" ...