I / Choreographer:跳过38帧

时间:2016-01-08 19:58:53

标签: android

我开始在Android中开发,我想知道是否有其他方法可以更改文本字体。

public class MainActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.escena_1/* .activity_main*/);


/* IM USING THIS */
        TextView tx = (TextView) findViewById(R.id.textViewx);
        Typeface custom_font = Typeface.createFromAsset(getAssets(), "font/OpenSans-Light.ttf");
        tx.setTypeface(custom_font);



    }
}

好吧,除此之外别无他法。但是我得到了错误"跳过38帧"。

1 个答案:

答案 0 :(得分:0)

感谢您的回答。

这是我的mainactivity.java



package com.example.asus.app1;

    import android.graphics.Typeface;
    import android.net.Uri;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.widget.TextView;
    
    import com.google.android.gms.appindexing.Action;
    import com.google.android.gms.appindexing.AppIndex;
    import com.google.android.gms.common.api.GoogleApiClient;

    public class MainActivity extends AppCompatActivity {
  
    private GoogleApiClient client;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.escena_1/* .activity_main*/);


        TextView tx = (TextView) findViewById(R.id.textViewx);
        Typeface custom_font = Typeface.createFromAsset(getAssets(), "font/OpenSans-Light.ttf");
        tx.setTypeface(custom_font);

        TextView texto_2 = (TextView) findViewById(R.id.textView2);
        texto_2.setTypeface(custom_font);


        // ATTENTION: This was auto-generated to implement the App Indexing API.
        // See https://g.co/AppIndexing/AndroidStudio for more information.
      ///  client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
    }


    }




这是mya" escena_1" XML



<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    style="@android:style/Theme.Material.Light.Dialog.NoActionBar">

    <ImageView
        android:layout_width="130dp"
        android:layout_height="130dp"
        android:id="@+id/imageView"
        android:layout_gravity="center"
        android:src="@drawable/image_1"
        android:contentDescription="@string/imagen_1"
        android:focusable="true"
        android:cropToPadding="false"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="83dp" />
<!--StayWithMe12!-->
    <TextView
        android:layout_width="206dp"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="@string/text_1"
        android:id="@+id/textViewx"
        android:layout_gravity="center_horizontal|bottom"
        android:gravity="top"
        android:textIsSelectable="false"
        android:textSize="33sp"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="@string/text_2"
        android:id="@+id/textView2"
        android:textSize="15sp"
        android:textIsSelectable="false"
        android:textAlignment="center"
        android:textColor="#666666"
        android:layout_below="@+id/textViewx"
        android:layout_alignParentStart="true"
        android:layout_marginTop="27dp" />

</RelativeLayout>`enter code here`
&#13;
&#13;
&#13;