I am trying to grey out my menu item text when it is disabled but am having trouble getting it to work. My menu.xml file is;
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<group
android:checkableBehavior="single">
<item
android:id="#+id/item1"
android:checked="false"
android:icon="#drawable/icon_item1"
android:title="item1"
app:actionLayout="#layout/item1Counter"/>
<item
android:id="#+id/about_us"
android:checked="false"
android:title="About Us" />
</group>
</menu>
I disable the menu item above by the following:
var menu1 = menuList.Menu.GetItem(0);
menu1.SetEnabled(false);
//Here is where I want to grey out the icon
Anyone know how I could do that. Also, item1Counter is the item action layout which also has text that will be greyed out. I want everything in item to be greyed out when after I disable it. Anyone know how I can do that?
Related
I am developing a Microsoft Excel Addin.
I need to add a button on context menu (right click) on cell selected text. I have found the ContextMenuCell idMso but this works only on whole cell right click.
Here is my ribbon's xml:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<ribbon>
</ribbon>
<contextMenus>
<contextMenu idMso="ContextMenuCell">
<button id="TranslateTextButton" label="Test Label" onAction="OnRibbonClick" getImage="GetIcon"/>
</contextMenu>
</contextMenus>
</customUI>
I wonder if exists something like ContextMenuCell for cell's text and not whole cell. Thank you in advance!
After many searches I found ContextMenuFormulaBar which enables right click on formula bar and also in a cells inner (text etc.).
Any one could suggest how to reduce space between spinner items height having radio buttons.
My Code is below .
Layout
<Spinner android:layout_width="250dp"
android:layout_height="40dp"
android:id="#+id/spinnerCompany"
android:theme="#style/SpinnerTheme"
android:background="#android:drawable/btn_dropdown" />
Spinner Theme
<style name="SpinnerTheme">
<item name="android:layout_width" >fill_parent</item>
<item name="android:textSize" >15dp</item>
<item name="android:layout_width" >fill_parent</item>
<!--<item name="colorAccent">#00f</item>
<item name="colorControlNormal">#00f</item>-->
</style>
Activity Code
ArrayAdapter CompanyAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, cls_static.ToArrayList(ListofCompnyFromDB));
CompanyAdapter.SetDropDownViewResource(Android.Resource.Layout.SelectDialogSingleChoice);
spinnerCompanyObj.Adapter = (CompanyAdapter);
Getting output like below any help would be appreciated.
You can add the android:dropDownWidth="100dp" in Spinner
<Spinner android:layout_width="250dp"
android:dropDownWidth="100dp"
android:layout_height="40dp"
android:id="#+id/spinnerCompany"
android:theme="#style/SpinnerTheme"
android:background="#android:drawable/btn_dropdown" />
There is running screenshot.
I have made a minor change like below and it get resolved.
Activity
CompanyAdapter.SetDropDownViewResource(Resource.Drawable.styl_spinner_style);
styl_spinner_style
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="37dp"
android:ellipsize="marquee"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:textColor="#252c3b"/>
I'm trying to create a toolbar to save items in my application. But my toolbar is not showing properly.
It is showing like this
I want to display like this
In my Fragment
public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
{
inflater.Inflate(Resource.Menu.menu_RefuelingToolbar, menu);
}
menu_RefuelingToolbar.xml
<?xml version="1.0" encoding="utf-8" ?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".RefuelingFragment">
<item android:id="#+id/button_Save"
android:icon="#drawable/ic_done_white_24dp"
android:showAsAction="always"
android:title="Settings" />
</menu>
If you extend AppCompatActivity instead of Activity like this :
public class MainActivity : AppCompatActivity {...}//instead of Activity
In this case, the toolbar cant showing picture, the reason is that :
When using the appcompat library, menu resources should refer to the showAsAction in the app: namespace, not the android: namespace.
Similarly, when not using the appcompat library, you should be using the android:showAsAction attribute.
I think the problem is that you are mixing Framework Activity and AppCompat menu.
You should use AppCompatActivity with AppCompat Action bar and app:showAsAction; or Activity with android:showAsAction.
EDIT : Modify your code in menu_MGradeToolbar.xml like this :
<?xml version="1.0" encoding="utf-8" ?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<item android:id="#+id/button_MGradeSave"
android:icon="#drawable/ic_done_white_24dp"
app:showAsAction="ifRoom"
android:title="Save" />
</menu>
Here is the result.
I have been having problems with incorporating a Progress Bar into my splash screen. I have an XML file called splash_setup,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/background">
<bitmap
android:src="#drawable/splash"
android:tileMode="disabled"
android:gravity="top|center_horizontal" />
<ProgressBar
style="#android:style/Widget.ProgressBar.Small"
android:gravity="top|center_horizontal" />
</LinearLayout>
This file is used as background for 'splashTheme' (in Styles.XML) as following,
?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="splashTheme" parent="android:Theme">
<item name="android:windowBackground">#drawable/splash_setup</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
The splashTheme is used in splashActivity (the splash executes database initialisation and then finished),
[Activity(Label = "#string/appName", Theme = "#style/splashTheme",
MainLauncher = true, NoHistory = true)]
So to my problem... the splash_setup code runs fine without tags, but when they are in I get the following error,
android.content.res.Resources$NotFoundException: File res/drawable/splash_setup.xml from drawable resource ID #0x7f020002
Could anyone point out what I am doing wrong? Thanks!
What you have is a layout not a drawable. android:windowBackground attribute in style allows only drawable which may include shapes and/or layer lists. If you really wish to show a progressbar, then you need an activity.
I am developing a Power Point Add-in (Using C#) in which I have to add a Custom Menu Entry in the "File" Menu.
I followed all the steps in http://msdn.microsoft.com/en-us/library/bb608602(v=vs.100).aspx
but my menu is not showing up in Powerpoint.
Do I need to anything extra here ?
You must check i would my add-in to lad the host
Link of full sample : http://csharpmentor.blogspot.fr/2009/05/how-to-create-powerpoint-add-in-in-cnet.html
#Nilzor, I found the Solution, It is called Backstage view
We need to add the in the XML to make it work
<?xml version="1.0" encoding="utf-8"?>
<customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<backstage>
<tab id="MyBackstageTab"
label="My Tab"
getVisible="MyBackstageTab_GetVisible">
</tab>
</backstage>
</customUI>