我想在我的应用程序中将sans-serif light设置为默认字体.我正在使用Android Lollipop设备.所以,这是我的styles.xml:
<resources>
<style name="AppBaseTheme" parent="android:Theme.Material.Light.DarkActionBar">
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:textViewStyle">@style/RobotoTextViewStyle</item>
<item name="android:buttonStyle">@style/RobotoButtonStyle</item>
</style>
<style name="RobotoTextViewStyle" parent="android:Widget.TextView">
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="RobotoButtonStyle" parent="android:Widget.Button">
<item name="android:fontFamily">sans-serif-light</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
当我在我的设备上运行应用程序时,在每个视图中都不应用sans-serif-light.例如,ActivityMain.java中的TextViews显示我想要的字体,但在其他活动中,如SecondActivity.java,所有TextView都会正常显示.如果我在使用Android 4.1的设备上运行我的应用程序,它适用于每个视图.我究竟做错了什么?提前致谢 :)
android font-family android-fonts typeface android-5.0-lollipop
我正在学习Material Design,特别是我想使用Material Design自定义我的应用程序,也适用于较旧的Android版本.我正在阅读本指南:https://developer.android.com/training/material/compatibility.html#SupportLib
关于调色板,指南说:
要获取材料设计样式并使用Android v7支持库自定义调色板,请应用以下Theme.AppCompat主题之一:
<!-- extend one of the Theme.AppCompat themes -->
<style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
<!-- customize the color palette -->
<item name="colorPrimary">@color/material_blue_500</item>
<item name="colorPrimaryDark">@color/material_blue_700</item>
<item name="colorAccent">@color/material_green_A200</item>
</style>
Run Code Online (Sandbox Code Playgroud)
当我尝试运行此代码时,我收到此错误:
错误:错误:找不到与给定名称匹配的资源:attr'colorAccent'.
...和colorPrimaryDark和colorPrimary的错误相同!如果我将此代码运行到values-v21/style.xml文件中,则将"android:"标记放在colorPrimary,colorPrimaryDark和colorAccent之前,如下所示:
<item name="android:colorPrimary">@color/material_blue_500</item>
<item name="android:colorPrimaryDark">@color/material_blue_700</item>
<item name="android:colorAccent">@color/material_green_A200</item>
Run Code Online (Sandbox Code Playgroud)
有用!
所以...我不明白我错在哪里:(我肯定更新了v7支持库
任何帮助将不胜感激!:)
android color-palette android-support-library material-design
在iOS 9发布之前,我开发了一款面向iOS 8.4的应用.我UITableView
通过segue of kind"Show(例如Push)" 使用了一些相互连接.它与正确的行为完美配合:每次我从一个切换UITableView
到另一个时,后退按钮出现,所以用户可以回到前一个场景; 后退按钮也出现UITableView
在UIViewController
,使用相同类型的segue.
现在,我已经升级到Xcode的最新版本,并针对应用到iOS 9.0,我得到了这个问题:现在,如果我走的时候UITableView
到另一个UITableView
,后退按钮不会出现了,但如果我走的时候UITableView
到UIViewController
,背按钮出现.我见过其他开发人员遇到了类似的问题(你可以在这里,这里和这里看到),但我不明白他们是如何解决的(除了第三个链接,但这不是我的情况).任何人都知道如何让按钮再次工作?提前致谢
我正在开发一个应用程序,您可以在其中录制音频剪辑,将其上传到Parse.com上的数据库,然后从Parse.com检索音频剪辑并播放它.
我能够在Parse.com上录制和上传音频文件,但我不知道该如何处理最后一步!在这里,您可以看到我如何在Parse.com上保存和存储音频片段:
byte[] data = outputFile.getBytes();
//ParseUser currentUser = ParseUser.getCurrentUser();
//String usernameText = currentUser.getUsername();
Calendar c = Calendar.getInstance();
String mUploadName = c.get(Calendar.SECOND) + "_recording.mp3";
ParseFile file = new ParseFile(mUploadName, data);
file.saveInBackground();
// _PostStructure is the class where I've wrote the "set" and "get" methods to use the database on Parse.com
_PostStructure new_audiofile = new _PostStructure();
new_audiofile.setAudioFile(file);
new_audiofile.saveInBackground();
Run Code Online (Sandbox Code Playgroud)
这是我尝试从Parse.com检索和播放音频剪辑:
mediaPlayer = new MediaPlayer();
ParseQuery<ParseObject> query = ParseQuery.getQuery("MyClass");
query.getInBackground("jZAetQnISj", new GetCallback<ParseObject>() {
public void done(ParseObject recording, com.parse.ParseException e) {
if (e != …
Run Code Online (Sandbox Code Playgroud) audio android audio-streaming android-mediaplayer parse-platform
我正在尝试从我的应用程序发送一封带有附件的电子邮件。当选择器弹出时,如果我点击 GMail,GMail 就会崩溃;如果我点击设备的默认电子邮件客户端,它就会完美运行。附件是从外部 SD 中获取的 jpeg。
这里是代码:
filelocation = gv.getPath();\n Intent emailIntent = new Intent(Intent.ACTION_SEND);\n // set the type to \'email\'\n emailIntent.setType("image/jpeg");\n String to[] = {"myemailaddress@gmail.com"};\n emailIntent.putExtra(Intent.EXTRA_EMAIL, to);\n // the attachment\n emailIntent.putExtra(Intent.EXTRA_STREAM, filelocation);\n // the mail subject\n emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");\n emailIntent.putExtra(Intent.EXTRA_TEXT, "Body");\n emailIntent.setType("message/rfc822");\n startActivity(Intent.createChooser(emailIntent, "Send email using:"));\n
Run Code Online (Sandbox Code Playgroud)\n\n这里是日志猫:
\n\n03-14 19:03:26.081 27428-27428/com.android.myapp W/Bundle\xef\xb9\x95 Key android.intent.extra.STREAM expected Parcelable but value was a java.lang.String. The default value <null> was returned.\n03-14 19:03:26.111 27428-27428/com.android.myapp W/Bundle\xef\xb9\x95 Attempt to cast generated internal exception:\n java.lang.ClassCastException: java.lang.String …
Run Code Online (Sandbox Code Playgroud) android ×4
audio ×1
back-button ×1
email ×1
font-family ×1
gmail ×1
ios ×1
objective-c ×1
segue ×1
send ×1
typeface ×1
uitableview ×1