使用Android 4.4版(KitKat),可以使用命令行中的ADB,使用以下命令记录Android设备的屏幕.
adb shell screenrecord /sdcard/demo.mp4
Run Code Online (Sandbox Code Playgroud)
但这仅适用于Android 4.4版(KitKat)和5.0版(Lolipop)
是否还有其他命令或方法使用ADB在Android 4.4版(KitKat)下录制视频?
当我启动应用程序它给我这个错误
FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.android.tools.fd.runtime.AppInfo
at com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:229)
at android.app.Application.attach(Application.java:181)
at android.app.Instrumentation.newApplication(Instrumentation.java:991)
at android.app.Instrumentation.newApplication(Instrumentation.java:975)
at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4417)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Run Code Online (Sandbox Code Playgroud) 如何获取自定义fontname自定义TextView的属性设置字体到Textview. 基于Attributes值设置TextView中的Font
public class MyTextView extends TextView
{
public MyTextView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
init();
}
public MyTextView(Context context, AttributeSet attrs)
{
super(context, attrs);
init();
}
public MyTextView(Context context)
{
super(context);
init();
}
public void init()
{
// set font_name based on attribute value of textview in xml file
String font_name = "";
if (!isInEditMode())
{
Typeface tf = Typeface.createFromAsset(getContext().getAssets(),
"fonts/"+font_name);
setTypeface(tf);
}
}
Run Code Online (Sandbox Code Playgroud)
在Xml文件中
<com.Example.MyTextView
android:id="@+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fontname="font.ttf"
android:text="Header"
/>
Run Code Online (Sandbox Code Playgroud)
我也把font.ttf文件放在assets-> fonts 谢谢你