小编buc*_*zek的帖子

如何在应用程序上修复白屏启动?

我有一个Android应用程序,在启动时显示白色屏幕2秒.我的其他应用程序不这样做,但这个应用程序.我还实现了一个启动画面,希望能解决这个问题.我应该增加闪屏的睡眠时间吗?谢谢.

android splash-screen app-startup

103
推荐指数
6
解决办法
9万
查看次数

配置文件与应用程序标识符权利的权利文件值不匹配

我正在尝试将应用程序上传到应用程序商店,并且我在具有证书的页面上收到此错误.据我所知,我已经改变了场地,所以他们已经匹配,但我错过了一些东西.

这就是弹出的东西

任何帮助将不胜感激.

info.plist中

ios

79
推荐指数
6
解决办法
3万
查看次数

如何在Swift中的UIWebView中加载URL?

我有以下代码:

UIWebView.loadRequest(NSURLRequest(URL: NSURL(string: "google.ca")))
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

'NSURLRequest'无法转换为UIWebView.

知道问题是什么吗?

swift ios8

63
推荐指数
10
解决办法
11万
查看次数

如何使用x-www-form-urlencoded正文发送帖子请求

邮递员要求

如何在java中,我可以发送请求x-www-form-urlencoded header.我不明白如何发送带有键值的正文,就像上面的截图一样.

我试过这段代码:

String urlParameters =
  cafedra_name+ data_to_send;
URL url;
    HttpURLConnection connection = null;  
    try {
      //Create connection
      url = new URL(targetURL);
      connection = (HttpURLConnection)url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Content-Type", 
           "application/x-www-form-urlencoded");

      connection.setRequestProperty("Content-Length", "" + 
               Integer.toString(urlParameters.getBytes().length));
      connection.setRequestProperty("Content-Language", "en-US");  

      connection.setUseCaches (false);
      connection.setDoInput(true);
      connection.setDoOutput(true);

      //Send request
      DataOutputStream wr = new DataOutputStream (
                  connection.getOutputStream ());
      wr.writeBytes (urlParameters);
      wr.flush ();
      wr.close ();
Run Code Online (Sandbox Code Playgroud)

但在回复中,我没有收到正确的数据.

java

37
推荐指数
2
解决办法
9万
查看次数

待通知意图不起作用

下面是我的代码块,它应该NotificationActivity在点击通知时打开.但它不起作用.

private void setNotification(String notificationMessage) {
    Uri alarmSound = getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    mNotificationManager  = getApplication().getSystemService(Context.NOTIFICATION_SERVICE);

    Intent notificationIntent = new Intent(getApplicationContext(), NotificationActivity2.class);

    PendingIntent contentIntent = PendingIntent.getActivity(this, 0,notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext())
    .setSmallIcon(R.drawable.logo)
    .setContentTitle("My Notification")
    .setStyle(new NotificationCompat.BigTextStyle()
    .bigText(notificationMessage))
    .setContentText(notificationMessage).setAutoCancel(true);
    mBuilder.setSound(alarmSound);
    mBuilder.setContentIntent(contentIntent);
    mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());

}
Run Code Online (Sandbox Code Playgroud)

android android-pendingintent

34
推荐指数
3
解决办法
4万
查看次数

在android的strings.xml中写%

我想在我的strings.xml文件中创建以下字符串数组:

<string-array name="an_array_columns">
         <item>% Select percentage1</item>
         <item>% Select percentage2</item>
</string-array>
Run Code Online (Sandbox Code Playgroud)

这里的字符串是"%select percentage".现在,当我在strings.xml中写这个时,我收到以下错误:

Multiple annotations found at this line:
    - error: Multiple substitutions specified in non-positional format; did you mean to 
     add the formatted="false" attribute?
    - error: Found tag </item> where </string-array> is expected
Run Code Online (Sandbox Code Playgroud)

我知道我们可以改变&&amp;'\'的,但我该怎么为百分号吗?

android

28
推荐指数
2
解决办法
3万
查看次数

如何在android xml中使用自定义字体?

如何使用我的xml资产文件夹中添加的自定义字体?我知道我们可以setTypeface()在java中使用方法,但我们必须在我们使用它的地方执行此操作TextView.那么还有更好的方法吗?

android textview android-layout

25
推荐指数
1
解决办法
6万
查看次数

!预期JUnit版本3.8或更高版本

我的Android工作室项目有一个依赖于android框架的app模块,我创建了一个名为domain的新模块,它只包含纯java类和一些测试类.

在这个模块的build.gradle文件中,我添加了junit和mockito库用于测试目的,如下所示:

apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies {
    testCompile 'junit:junit:4.11'
    testCompile 'org.mockito:mockito-core:1.9.5'
    compile project(':common')
    compile project(':model')
    //test dependencies
}
Run Code Online (Sandbox Code Playgroud)

但是!!! JUnit version 3.8 or later expected每当我尝试执行测试类时,Android Studio都会给我错误消息.

此问题的所有建议解决方案是打开项目结构| 模块| 依赖关系,并将junit-4.7.jar向上移动,以便它在类路径中的Android 1.6 Platform之前出现.

事实上,我试图实现这个解决方案,但问题仍然存在. 我的依赖结构的图像

有关如何解决此问题的任何想法?

java junit android

25
推荐指数
3
解决办法
2万
查看次数

方向改变android时保存活动状态

我有一个aacplayer应用程序,我希望在方向从纵向更改为横向时保存我的活动状态.TextViews似乎不是空的,我尝试使用以下方法冻结我的textview:

android:freezesText="true"
Run Code Online (Sandbox Code Playgroud)

我的清单:

android:configChanges="orientation"
Run Code Online (Sandbox Code Playgroud)

我也试过这个:

@Override
    public void onConfigurationChanged(Configuration newConfig){
        super.onConfigurationChanged(newConfig);
        setContentView(R.layout.main2);
Run Code Online (Sandbox Code Playgroud)

因此,当方向更改为横向时,我可以看到我的layout-land main2.xml,它可以工作,但我的textview出来并显示为空.流媒体音乐很棒.我可以在方向更改时收听它,但每次更改设备的方向时,文本视图中的文本都会消失.

我应该怎么做才能解决这个问题,以便保存状态?

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
....
....
Run Code Online (Sandbox Code Playgroud)

非常感谢你.

android

20
推荐指数
2
解决办法
4万
查看次数

Android BottomSheet:隐藏在工具栏下

我尝试使用支持库23.2.0中的新底页将底页扩展为全屏,如设计指南中所建议的那样

这个效果非常好,但是底页位于我的ActionBar和我的标签下.

怎么可以让底页超过工具栏?我的菜单结构如下:

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/appbar_padding_top">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|snap|enterAlways"
            app:popupTheme="@style/AppTheme.PopupOverlay"/>

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

    <include
        android:id="@+id/playerLayout"
        layout="@layout/player_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:behavior_peekHeight="?attr/actionBarSize"
        app:layout_behavior="@string/bottom_sheet_behavior"
        app:model="@{model}"/>

</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

android android-support-library material-design androiddesignsupport

16
推荐指数
1
解决办法
1万
查看次数