小编lis*_*lis的帖子

没有动作栏的android compat黑暗活动?

如何在appcompat主题中实现没有操作栏的黑屏?我已经实现了导航抽屉,主题来自style.xml.

这是我目前的主题:

<resources>
  <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
    <item name="android:windowTranslucentStatus">true</item>
  </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

android themes android-appcompat

8
推荐指数
1
解决办法
3929
查看次数

android以编程方式清除日志

我想获得整个日志(Log.d(...)),按下按钮分析我们的应用程序的某些部分(计算一些东西......).我可以通过以下代码执行此操作:

HashMap<String, Integer> hashMapToSaveStuff = new HashMap<String, Integer>();
int count= 0;
String toCount= "";
try {
        Process process = Runtime.getRuntime().exec("logcat -d");
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
        String line;
        while ((line = bufferedReader.readLine()) != null) {
            if (line.contains("MYSTRING")) {
                toCount = line.substring(line.indexOf(":") + 1);
                if (hashMapToSaveStuff.containsKey(toCount)) {
                    count = hashMapToSaveStuff.get(toCount);
                    count++;
                } else {
                    count= 1;
                }
                hashMapToSaveStuff.put(toCount, count);
            }
        }
    } catch (Exception e) {

    }
Run Code Online (Sandbox Code Playgroud)

之后,我将结果发送到我们的服务器并将其保存在数据库中.因此,我想清除所有日志,我已经发送了.尝试使用以下代码执行此操作不起作用:

try {
        Process process = Runtime.getRuntime().exec("logcat -c");
        BufferedReader bufferedReader = new BufferedReader(new …
Run Code Online (Sandbox Code Playgroud)

android logcat

4
推荐指数
1
解决办法
3891
查看次数

设置camunda rest api

我想使用camunda rest api(本地),但我真的不知道如何设置环境......

首先,我从网上下载Tomcat的分布在这里从(V. 7.2.0)和预包装日食与BPMN 2.0建模这里

我建模了一个流程,启动服务器 ( start-camunda.bat) 并部署它(复制.war...camunda\server\apache-tomcat-7.0.50\webapps)。它在本地任务列表http://localhost:8080/camunda/app/tasklist/default/#/login和 cockpit http://localhost:8080/camunda/app/cockpit/default/ 上运行良好

我还engine-rest从“Maven Nexus Server”(安装 REST API Web 应用程序)下载了。现在,如果我调用引擎(http://localhost:8080/engine-rest/engine),我得到以下信息.json[{"name":"default"}]

接下来做什么?我真的不知道(我是camunda的新手......)

rest tomcat camunda

3
推荐指数
1
解决办法
8289
查看次数

css flexbox按屏幕宽度打破父级

如果有类似的东西:

<!DOCTYPE html>
<html lang="de">
    <head>
        <link rel="stylesheet" href="/styles/screen.css?v=737285430" media="screen, projection" />
    </head>
    <body>
        <section id="articlesShorten">
            <article class="articleShorten">
                text1
            </article>
            <article class="articleShorten">
                text2
            </article>
            <article class="articleShorten">
                text3
            </article>
            <article class="articleShorten">
                text4
            </article>
            <article class="articleShorten">
                text5
            </article>
            <article class="articleShorten">
                text6
            </article>
        </section>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

CSS:

#articlesShorten {
  display: -webkit-box;
  -webkit-box-orient: horizontal;

  display: -moz-box;
  -moz-box-orient: horizontal;

  display: box;
  box-orient: horizontal;
}

.articleShorten {
  -webkit-box-flex: 0;
  -moz-box-flex: 0;
  box-flex: 0;
  border: 1px solid red;
}
@media (min-width: 1000px) {
  .articleShorten {
    width: 30%; …
Run Code Online (Sandbox Code Playgroud)

css flexbox

2
推荐指数
1
解决办法
1805
查看次数

AlertDialog中ListView下的按钮被隐藏

我想在AlertDialog中显示一个带有按钮的列表.按钮用于关闭Dialog本身.我扩展AlertDialog并增加了一些LayoutParamsWindow延长整个屏幕宽度的对话框:

    //Grab the window of the dialog, and change the width
    WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    Window window = getWindow();
    lp.copyFrom(window.getAttributes());
    //This makes the dialog take up the full width
    lp.width = WindowManager.LayoutParams.MATCH_PARENT;
    lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
    window.setAttributes(lp);
Run Code Online (Sandbox Code Playgroud)

好.但是如果列表很长(显示已满),我可以滚动ListView但按钮下面没有显示.这是对话框的ContentView:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ListView
    android:id="@+id/choose_equipment_list"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<Button
    android:layout_below="@+id/choose_equipment_list"
    android:id="@+id/btn_choose_equipment_close"
    style="@style/custom_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="close" />

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

无论多长时间,我该怎么做才能在列表下方显示按钮?(我读了很多警告,把它ListView放进去ScrollView,无论如何都尝试过但失败了......)

android listview scrollview scrollable

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

Android AsyncTask锁定数据库

我有片段,我在每个片段中缓存数据.我通过从服务器下载doInBackground方法将数据缓存在AsyncTask中,并将其保存在onPostExecute中保存到我的数据库中.所以我总是在onPostExecution中打开数据库连接.如果我滚动"快速"扔掉片段,我认为AsyncTasks通过了预览实例,并且android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)在行中会有一个,我在那里打开连接(获取dbHelper.getWritableDatabase())

我认为有两种方法可以解决这个问题:

  • onPostExecution方法必须等到预览AsyncTask(onPostExecution)完成

  • 有一种方法可以为AsyncTask的所有实例使用相同的数据库连接,而无需相互锁定它们

它是否正确?有人有点想法,怎么做?

android locking android-asynctask android-sqlite

0
推荐指数
1
解决办法
1396
查看次数