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>
Related
id like to do something like tree graph with buttons. Idk how to explain my idea so ive created image. I build my website via Elementor. Is it even possible please?
My image
You can do this in one section using buttons and dividers, set width for the divider, and set it using margin and padding
I am trying to create a profile menu for my polymer website, something on the lines of github.com
If you notice,there is a triangular tip at the top of the menu.I am trying to create a similar triangle at the top of paper-listbox.
The problem I am facing is that the triangle seems to hide as soon as it gets out of the boundaries of paper-listbox.
I have create a jsbin to demonstrate my problem: http://jsbin.com/samaloqowu/1/edit?html,console,output
If you change the top property of the triangle (say -16px), it hides when it gets out of the listbox region. Please help me solve this CSS issue.
Short answer : No you can't.
Explanation : Because the dropdown content get encapsulated in a slotted element that gets styled inside the shadowRoot of the custom element you try to modify the behavior. And the paper-menu-button doesn't actually gives you a way to directly customize the slotted.
But there is a trick ! You can access the slotted through classic javascript. Just alter your connectedCallback function and add this line :
...
connectedCallback() {
super.connectedCallback();
this.$.profileMenu.$.dropdown.querySelector('.dropdown-content').style.overflow = 'visible';
...
}
...
This should do the trick, I agree this looks totally awful and trying to force and change the initial behavior of an element is not really recommended but well it seems to work, just make some tests when the element gets in a new context to see if anything breaks.
UPDATE (22/09/2017) :
Thinking of that again, I think this is a terrible idea to change this overflow to visible, I guess the polymer team has set the overflow to auto because if the list get long and you force the height of the element, the list will flow and be visible which is not really a dropdown anymore, but more like a full list display and that will mess with the general design purpose of your app. IMO when you start trying to mess with the inner properties of a custom element it means this element doesn't quench your requirement, and that it's time to make your own, especially when you try to modify the design of a custom element that has a design already implemented.
I have complex design that has several layers on top of each other. Problem is that if I click on object, other object that on top of it gets selected. How I can switch off visibility of my top objects while working on my bottom layer, so that they won't get in the way?
I finally found how to achieve what I wanted. Just select element that in the way and in properties remove tick from visible. Now you can design without anything obstructing your view! Just don't forget to make visible all elements before you save your work.
I'm using Dojo GFX to do some simple drawing, but having a problem with IE 7/8 (switching browsers is not an option).
If I create a div, set up a surface and draw some rects, they draw correctly relative to the div, so far so good.
However, what I want to do is create a widget, something with an embedded 'surface' that draws based on some widget-specific data. As such, I have a widget that contains a div, and I draw into this div. When I do that, the rects I create behave as if they are responding to a float:right, appearing in order they are created and ignoring the 'x' parameter.
I assume that this behaviour is something to do with CSS, but I haven't got to the bottom of it yet. Any ideas or solutions gratefully appreciated!
Updates:
I've disabled all stylesheets and I am not using style attributes. No difference to the behaviour.
I've inspected the markup that gets generated using IE8 dev tools. Apart from the different location of the containing div, the only difference I can see is that the v:roundrect elements have no child elements when created against the widget div, but they do have empty elements like stroke when created against the div referenced by ID.
Reading back through the docs, a difference I can see that might be responsible is that the postCreate method where I am doing my drawing is manipulating a div that has not been added to the dom yet, whereas drawing on a hardcoded div is done when it does exist. Maybe the difference in rendering is something to do with this? Is there a specific lifecycle function which is appropriate to draw in for widgets?
It seems that if you are going to use Dojo GFX and draw on DOM elements that are created as part of a widget in IE7/8, you must actually do the drawing in an override of the startup() method.
Drawing in the postCreate() method causes incorrect rendering resembling a float: left.
First of all, I am sorry that this is not a 'question that can be answered' like it is written in 'How to ask' section, but I think that stackoverflow is the place where I will get the best 'answers' so please help me with this one;
I have in mind to make some Flex application which will be used as some kind of (powerpoint) presentation.
My idea is to make some kind of template which will hold basic stuff like header, footer, and mainContent...
Header will be probably 'static' which means that it will hold some constant values (strings). Footer will have few static strings and an option to display current slide / total slides. Main content would be just some Canvas and I imagine that easiest way to make all my slides is to make a component (which will extend Canvas) for each slide so I will be able to 'design' each slide however I want...
The most important thing is that I should be able to define a transition between slides (some of Flex effects - Move, Fade, etc). And maybe even extend that option to some other Flex libraries (maybe like Distortion Effects or similar).
And finally I should be able to define how much 'steps' each slide has... For example, when you click next, slide can switch to next slide or it can stay on same slide and change some values inside of it (like changing graph values or something).
I started to make my application and for now I made an XML file which holds a title and effect definition for each slide. I made 3 AS classes which are header, footer and mainContent. I was playing around with effects and counting pages and such basic stuff and for now things seems fine... But I am stuck with 'implementing' my canvases (slide content) to each slide...
Nevertheless, I don't ask you to make some code for me... I just want to know if I get the idea correctly... I would need just few guidelines how to 'set-up' my application so it could have all those features I need =)
Thank you very much for any help really!
Cheers!
You seem to be going well with it. Have you considered using a view stack as slide holder?
<vbox>
<header/>
<viewstack>
<Slide/>
<Slide/>
</viewstack>
<footer/>
<hbox-with-navigation-buttons/>
</vbox>
The base class Slide extends Canvas
The Slide class describes (abstract) methods to go to next/prev step.
Viewstack listens for navigation button clicks and passes it to current slide and changes slides only if current slide has no more steps.
Bind the header property of viewstack.selectedItem to the header
Bind viewstack.selectedIndex to the page number in footer.
I'd use a viewstack as Amarghosh suggested, but then also create a base class or interface for each of your slides that has a 'stepForward()' and perhaps a 'stepBackward()' function. That way you'll know each of your items in your viewstack has those functions available for you to call, but each viewstack item can implement these functions differently.
You can use the hideEffect and showEffect properties of the viewstack's children to define cool transistion between slides. Something like this:
<!-- wipe transistion effects -->
<mx:WipeUp id="myWU" duration="300"/>
<mx:WipeDown id="myWD" duration="300"/>
<viewstack>
<Slide id="slide_1" showEffect="{myWU"}" hideEffect="{myWD}"/>
<Slide id="slide_2" showEffect="{myWU"}" hideEffect="{myWD}"/>
</viewstack>
Will cause the wipe effects to be played when you switch from slide 1 to slide 2.