Regex match tag with no spaces - regex

I've the below html tags.
<item id="ID1" num="num1">
<item id="ID1">
I want a regex to match <item id="ID1"> and ignore <item id="ID1" num="num1">.
please let me know how can i do this.
Thanks

I'd use:
/<item id="[^"]+">

You can use \S+ to match any non-space characters.
<item id=\S+>

Try:
<item id=\"[^ ]*\">

/<item id=".*?"\s*>
You can try this.

Related

Bottom border in actionbar only appear in tab

In my app I have an action bar . The problem is when I test my app in tab , there is a border under the action bar . (Screenshot attached below)
http://imgur.com/zOdCynv
But in any other phone there is no border (Screen shot attached below)
http://imgur.com/vs4klO3
Here is the code for my actionbar
<style name="ActionBar" parent="Widget.AppCompat.ActionBar.Solid">
<item name="android:background">#color/Navbar</item>
<item name="android:windowActionBarOverlay">false</item>
<item name="android:actionMenuTextColor">#color/white</item>
<item name="android:displayOptions">homeAsUp|showTitle</item>
<item name="displayOptions">homeAsUp|showTitle</item>
<item name="android:height">#dimen/abc_action_bar_default_height_material</item>
<item name="android:windowContentOverlay">#android:color/white</item>
<item name="icon">#android:color/transparent</item>
<item name="titleTextStyle">#style/MyTheme.ActionBar.TitleTextStyle</item>
<item name="elevation">0dp</item>
</style>
What is the reason of showing that border only in tab ? How can I remove it ?
Note: The OS of that tab is Android 4.4.2 KitKat
can you give a try with null and not white color.
<item name="android:windowContentOverlay">#null</item>

Android RatingBar numStart not working

I have simple RatingBar in my app. and i set numStarts="5" but it show more then 5 star. when i set android:layout_width="match_parent" I tried to several tutorials but also did't work, as per doc numStarts for show number of starts but in my case it did't work. i go through doc and several tutorials but did't get any solution.
but i want to only 5 stars in rating bar.
my rating bar is given below.
<RatingBar
style="#style/customRatingBar"
android:id="#+id/course_rating_bar"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
android:numStars="5"
android:isIndicator="false"
android:stepSize="1.0"/>
This is my custom style
<style name="foodRatingBar" parent="#android:style/Widget.RatingBar">
<item name="android:progressDrawable">#drawable/ratingstars</item>
<item name="android:minHeight">22dip</item>
<item name="android:maxHeight">22dip</item>
</style>
......
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+android:id/background"
android:drawable="#drawable/star_empty" />
<item android:id="#+android:id/secondaryProgress"
android:drawable="#drawable/star_empty" />
<item android:id="#+android:id/progress"
android:drawable="#drawable/star" />
</layer-list>
You have to set android:layout_width="wrap_content" rather than "match_parent". Then you will get the 5 stars.

custom background colors for ActionBar items

I have an ActionnBar for which I am trying to set the background color and I would like to change the background color of each items in the ActionBar with other color on "Tap".
This thing is not working for some reason. I have tried changing various options given in other topics.Nothing works not sure why. What is the right way to do it. I followed Android Developer website to do this and still is not reflected. Thanks for your time
My styles.xml
<style name="MyCustomTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyActionBarTheme</item>
<item name="android:actionButtonStyle">#style/MyActionBarButton</item>
<item name="android:selectableItemBackground">#drawable/circular_tap_state</item>
</style>
<style name="MyActionBarTheme" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#000000</item>
</style>
<style name="MyActionBarButton" parent="#android:style/Widget.Holo.Light.ActionButton">
<item name="android:actionBarItemBackground">#drawable/custom_settings_button</item>
</style>
custom_settings_button.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#android:color/holo_orange_light"
android:state_pressed="true" />
<item android:drawable="#android:color/holo_orange_light"
android:state_focused="true" />
<item android:drawable="#android:color/holo_orange_dark" />
</selector>
custom action bar - action_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="#+id/today"
android:showAsAction="always"
android:title="#string/menu_today"/>
<item
android:id="#+id/menu_list"
android:icon="#drawable/ic_custom_calender_icon_normal_state"
android:showAsAction="always"
android:title="#string/menu_calendar" />
<item
android:id="#+id/add_event"
android:icon="#drawable/ic_custom_add"
android:showAsAction="always"
android:title="#string/menu_add" />
<item
android:id="#+id/calendar_settings"
android:icon="#drawable/ic_custom_settings"
android:showAsAction="always"
android:title="#string/menu_settings" />
</menu>

Remove / Hide title from android support library actionbar

I want to use just the application logo instead of {application logo} + {title (text)} on android support action bar, app logo shows perfectly but app name shows up as title next to the logo.
I have tried tried following already:
getActionBar().setDisplayShowTitleEnabled(false);
This is not the best solution as title of the application is visible when application is loading up and is removed once app (or layout) is loaded completely.
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/darkblue</item>
<item name="android:textSize">0sp</item>
<item name="android:textColor">#00000000</item>
<!-- Support library compatibility -->
<item name="background">#color/darkblue</item>
</style>
This also doesn't have any effect on the application title on the support action bar.
Please suggest some alternatives, Thanks
Following changes to MyActionBar Style works perfectly!
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/darkblue</item>
<item name="android:displayOptions">showHome|useLogo</item>
<!-- Support library compatibility -->
<item name="background">#color/darkblue</item>
<item name="displayOptions">showHome|useLogo</item>
</style>

XSLT - how to match any non-text node children?

I'm new to XSLT and I can't figure out how to get an xsl:if that matches when there are no child tags.
I want this to match:
<context>
howdy
</context>
And this not:
<context>
<child>
howdy
</child>
</context>
the relevant xpath expression should look like:
//context[not(./*)]
You could also specify count(child::*) = 0 .