I use actionbarsherlock in my app and the icon on it isn't displayed as I want. How can I change paddings of the icon? I want the image to reach top bottom and left.
I had the same problem as you and I found the answer here
Just make an XML drawable and put it in the resource folder "drawable" (without any density or other configuration).
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="#drawable/my_logo"
android:right="10dp"/>
</layer-list>
The last step is to set this new drawable as logo in your manifest (or
on the Actionbar object in your activity)
Related
I have a master detail page that displays from the left. But Id also like this exact feature coming from the other side. so TWO side drawer menus.
It is possible to show the page on the other side by doing:
<MasterDetailPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:Khaled.Views.MainMenu"
Title="Title"
FlowDirection="RightToLeft"
x:Class="Khaled.Views.MainMenu.Page_MainMenu">
But this doesnt copy the page, it just shows it on the other side. I want TWO on each side (with the option to swipe it open)
Anyone got any idea on how to do that?
Like Mina Fawzy said, MasterDetailPage is obsolete as of version 5.0.0. Please use FlyoutPage instead.
You would be better to use the single side. When you set the VisualElement.FlowDirection property to RTL OR LTR, it would change the direction in which the UI elements on the page are scanned by the eye.
Left to Right:
Right to Left:
That's why we could not set both sides at the same time. But we could change the FlowDirection property at runtime through we do not suggest to do that. Changing this value at runtime causes an expensive layout process that will affect performance.
The way used to change the FlowDirection to RightToLeft.
Android:
Xaml:
<FlyoutPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App1.FlyoutPage1"
FlowDirection="LeftToRight"
xmlns:pages="clr-namespace:App1">
......
</FlyoutPage>
AndroidManifest.xml:
<application android:label="App1.Android" android:theme="#style/MainTheme" android:supportsRtl="true"></application>
iOS:
For ios, refer to the link below. https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/localization/right-to-left#ios
you can create icons in the top right and top left (hamburger menu)
and then control them by code.
FlowDirection --> this controls the direction of the menu
IsPresented --> flag to open or close menu by code
when you want to present the right menu
FlowDirection = "RightToLeft";
IsPresented= true;
for the left
FlowDirection = "LeftToRight";
IsPresented= true;
Recommendation
MasterDetails are deprecated use FlyoutPage
https://learn.microsoft.com/en-us/dotnet/api/xamarin.forms.masterdetailpage?view=xamarin-forms
My Snackbar coming below the software buttons in Marshmallow:
I have tried changing the view, but it is not helping.
Usually Snackbar requires the CoordinaterLayout or window decor's content which are considered as parent layout for Snackbar. Previously, it was not getting any parent layout so it directly considered WindowManager layout as parent layout. Using CoordinaterLayout as parent layout it, solved the problem.
The sample code for CoordinaterLayout is as follows:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:nimbuzz="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent">
</android.support.design.widget.CoordinatorLayout>
I want to build a tab view. I like to put the content of each tab in a separate FXML file.
With <fx:include source="Details.fxml" /> I can import an FXML into my main FMXL. The import works fine but unfortunately the Details.fxml content is only using the prefHeight and prefWidth defined in the Details.fxml. How can I configure that the included FXML uses the entire of the parent (the tab pane).
My Details.fxml view contains a TableView and the table should always use the entire width of window. Also if I resize the window.
Thanks for any hints.
Regards,
Manuel
I'm trying to style my android application and new to styling UI elements. I'd like to create a custom UI container which looks like the following:
I.e. the container draws the arrow shape around the content. I'm also hoping to have the feature such the the arrow end of the container will scale nicely according to the height of the content (so possibly using vector graphics), but this is less crucial.
After spending most of the day playing around with the UI with no success, I thought I'd ask for help here. I've tried playing around with custom UI elements, using the drawable right property, the background property and trying to construct it out of other elements.
Does anyone know the best way to do this?
Thanks
I dont think you need to draw the arrow shaped container yourself. You could use a transparent png and set it as a background for the container. e.g your xml should roughly look like this:
<LinearLayout
android:id="#+id/container_layout"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="#drawable/arrow_shaped_transparent_png">
<!-- The rest of the stuff goes in here e.g a textview in your case -->
</LinearLayout>
I want to replace the default title of the header with my image in Flex Panel.
I don't actually think this is possible with the built in panel. My recommendation would be to either create your own container that allows you to put an image in the header (quite complicated) or to create a composite component that has an image for its header and an area to add content e.g.
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:Image src="someImage.jpg" />
<mx:Canvas>
<!-- add content here -->
</mx:Canvas>
</mx:VBox>
I know this is old, but panels have the property titleIcon which can be set to a class to do this.
titleIcon="#Embed('img/image.png')"