{"id":184116,"date":"2013-06-21T12:11:05","date_gmt":"2013-06-21T08:11:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=184116"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=184116","title":{"rendered":"<span class=\"post_title\">\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0448\u0440\u0438\u0444\u0442\u043e\u0432 \u0432 \u0441\u0432\u043e\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0438\u0432\u0435\u0442, \u0432\u0441\u0435\u043c!<\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439, \u043a\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u0445\u043e\u0442\u044c \u043e\u0434\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434 \u0430\u043d\u0434\u0440\u043e\u0438\u0434, \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0441\u044f \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a \u0441\u0432\u043e\u0435\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0448\u0440\u0438\u0444\u0442. \u0412\u043e\u0442 \u0438 \u044f \u0437\u0430\u0434\u0430\u043b\u0441\u044f \u044d\u0442\u0438\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c. \u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432. <br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412\u043e\u0434 \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445:  <\/p>\n<pre><code class=\"java\">\tString custom_font = &quot;fonts\/custom_font.ttf&quot;;         Typeface CF = Typeface.createFromAsset(getAssets(), custom_font);          ((TextView) findViewById(R.id.sometextview)).setTypeface(CF); <\/code><\/pre>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0443 \u0432\u0430\u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 TextView \u0438 \u043a\u0430\u043a \u0431\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0448\u0440\u0438\u0444\u0442\u0430 \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u0443\u0447\u0430 \u0441\u0442\u0440\u043e\u043a. \u041c\u043d\u0435 \u044d\u0442\u043e \u043d\u0435 \u043f\u043e\u0434\u043e\u0448\u043b\u043e \u0438 \u044f \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435. \u041d\u0430\u0448\u0435\u043b \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0441\u044f.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 TextViewPlus:<\/p>\n<p>  <b>TextViewPlus.java<\/b>  <\/p>\n<pre><code class=\"java\">package com.example;  import android.content.Context; import android.content.res.TypedArray; import android.graphics.Typeface; import android.util.AttributeSet; import android.util.Log; import android.widget.TextView;  public class TextViewPlus extends TextView {     private static final String TAG = &quot;TextView&quot;;      public TextViewPlus(Context context) {         super(context);     }      public TextViewPlus(Context context, AttributeSet attrs) {         super(context, attrs);         setCustomFont(context, attrs);     }      public TextViewPlus(Context context, AttributeSet attrs, int defStyle) {         super(context, attrs, defStyle);         setCustomFont(context, attrs);     }      private void setCustomFont(Context ctx, AttributeSet attrs) {         TypedArray a = ctx.obtainStyledAttributes(attrs, R.styleable.TextViewPlus);         String customFont = a.getString(R.styleable.TextViewPlus_customFont);         setCustomFont(ctx, customFont);         a.recycle();     }      public boolean setCustomFont(Context ctx, String asset) {         Typeface tf = null;         try {         tf = Typeface.createFromAsset(ctx.getAssets(), asset);           } catch (Exception e) {             Log.e(TAG, &quot;Could not get typeface: &quot;+e.getMessage());             return false;         }          setTypeface(tf);           return true;     }  } <\/code><\/pre>\n<p>  \u0424\u0430\u0439\u043b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432:<br \/>  <b>attrs.xml<\/b> (res\/values)  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;resources&gt;     &lt;declare-styleable name=&quot;TextViewPlus&quot;&gt;         &lt;attr name=&quot;customFont&quot; format=&quot;string&quot;\/&gt;     &lt;\/declare-styleable&gt; &lt;\/resources&gt; <\/code><\/pre>\n<p>  \u0418 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e <b>main.xml<\/b>  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;LinearLayout      xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;     xmlns:foo=&quot;http:\/\/schemas.android.com\/apk\/res\/com.example&quot;     android:orientation=&quot;vertical&quot; android:layout_width=&quot;fill_parent&quot;     android:layout_height=&quot;fill_parent&quot;&gt;      &lt;com.example.TextViewPlus         android:id=&quot;@+id\/textViewPlus1&quot;         android:layout_height=&quot;match_parent&quot;         android:layout_width=&quot;match_parent&quot;         android:text=&quot;@string\/showingOffTheNewTypeface&quot;         foo:customFont=&quot;saxmono.ttf&quot;&gt;     &lt;\/com.example.TextViewPlus&gt; &lt;\/LinearLayout&gt; <\/code><\/pre>\n<p>  \u0424\u0430\u0439\u043b \u0448\u0440\u0438\u0444\u0442\u0430 \u00absaxmono.ttf\u00bb \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0443 \u00abassets\u00bb<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435:)<\/p>\n<p>  <b>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438:<\/b>  <\/p>\n<ul>\n<li><a href=\"http:\/\/kevindion.com\/2011\/01\/custom-xml-attributes-for-android-widgets\/\"><i><a href=\"http:\/\/kevindion.com\/2011\/01\/custom-xml-attributes-for-android-widgets\/\">kevindion.com\/2011\/01\/custom-xml-attributes-for-android-widgets\/<\/a><\/i><\/a><\/li>\n<\/ul>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/184116\/\"> http:\/\/habrahabr.ru\/post\/184116\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0438\u0432\u0435\u0442, \u0432\u0441\u0435\u043c!<\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439, \u043a\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u0445\u043e\u0442\u044c \u043e\u0434\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434 \u0430\u043d\u0434\u0440\u043e\u0438\u0434, \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0441\u044f \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a \u0441\u0432\u043e\u0435\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0448\u0440\u0438\u0444\u0442. \u0412\u043e\u0442 \u0438 \u044f \u0437\u0430\u0434\u0430\u043b\u0441\u044f \u044d\u0442\u0438\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c. \u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-184116","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/184116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=184116"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/184116\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=184116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=184116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=184116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}