Posts

Showing posts from May, 2017

Android Toolbar Center Title And Custom Font

Image
Answer : To use a custom title in your Toolbar all you need to do is remember is that Toolbar is just a fancy ViewGroup so you can add a custom title like so: <android.support.v7.widget.Toolbar android:id="@+id/toolbar_top" android:layout_height="wrap_content" android:layout_width="match_parent" android:minHeight="?attr/actionBarSize" android:background="@color/action_bar_bkgnd" app:theme="@style/ToolBarTheme" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Toolbar Title" android:layout_gravity="center" android:id="@+id/toolbar_title" /> </android.support.v7.widget.Toolbar> This means that you can style the TextView however you would like because it's just a regular TextView . So in your activity you can access the title

Constructors In Kotlin

Answer : Well init is not body of constructor. It is called after primary constructor with the context of primary constructor. As given in Official documentation: The primary constructor cannot contain any code. Initialization code can be placed in initializer blocks, which are prefixed with the init keyword: class Customer(name: String) { init { logger.info("Customer initialized with value ${name}") } } Note that parameters of the primary constructor can be used in the initializer blocks. They can also be used in property initializers declared in the class body: class Customer(name: String) { val customerKey = name.toUpperCase() } In fact, for declaring properties and initializing them from the primary constructor, Kotlin has a concise syntax: class Person(val firstName: String, val lastName: String, var age: Int) { // ... } As per your question you can add a constructor to accept one parameter like following: class Person(name: String, surn

Css Textalign Center Code Example

Example: css text align right body { text-align : right ; }

Adobe Xd How To Crop Images Code Example

Example: how to crop in adobe xd Place the picture in xd. Draw a rectangle on the artboard. (This will maintain the cropped size of img) Select both of them, right click, mask with shape. Adjust the picture to your needs.

CSS: Line-through With A Color Different From The Text Color?

Answer : You can simulate the desired effect with two nested elements, e.g.: span.inner { color: green; } span.outer { color: red; text-decoration: line-through; } <span class="outer"> <span class="inner">foo bar</span> </span> jsfiddle With no extra DOM (but may not work for some layouts for obvious reasons): <style type="text/css"> .strikethrough { position: relative; } .strikethrough:before { border-bottom: 1px solid red; position: absolute; content: ""; width: 100%; height: 50%; } </style> <span class="strikethrough">Foo Bar</span> A jsfiddle example here. It's not possible to make a line-through with a different color. It will be in the color you define with property color . see http://www.w3.org/TR/CSS2/text.html#lining-striking-props EDIT : w

Angstrom Unit Of Measure Latex Code Example

Example: angstrom unit of measure latex $\mathring{A}$

First Letter Uppercase In Html Code Example

Example: css all caps .uppercase { text-transform : uppercase ; } #example { text-transform : none ; /* No capitalization, the text renders as it is (default) */ text-transform : capitalize ; /* Transforms the first character of each word to uppercase */ text-transform : uppercase ; /* Transforms all characters to uppercase */ text-transform : lowercase ; /* Transforms all characters to lowercase */ text-transform : initial ; /* Sets this property to its default value */ text-transform : inherit ; /* Inherits this property from its parent element */ }

ContentEditable, CTRL-B CTRL-I And Saving

Answer : This is standard in all major browsers. There are also programmatic equivalents of the keyboard shortcuts available via document.execCommand() in all major browsers. Bold and italic commands, for example, can executed as follows: document.execCommand("Bold", false, null); document.execCommand("Italic", false, null); However, the mark-up generated varies between browsers. For example, variations for bold include <b>foo</b> , <strong>foo</strong> and <span style="font-weight: bold">foo</span> . References: MSDN, list of commands MDN (Mozilla) Short answer 'yes'. You might find this article interesting. Many a' developer have gone down this route. If you want a nice wysiwyg editor, there are many to choose from. On to your question: yes you can read the formatting. Try an innerHTML on the element and you'll find <b> tags around your bolds and <i> around your italics. Also - i

Connection String To Connect To .MDF

Answer : If you're using the *.mdf file in the App_Data folder of an ASP.NET app you can use this. Server=.\SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf;Database=dbname; Trusted_Connection=Yes; If it's not an ASP.NET application don't use the DataDirectory syntax and just use the full c:\... path.