小编Azu*_*ame的帖子

Android scrollview删除蓝灯

当您使用scrollview在Android上滚动时,它会向您滚动的方向生成蓝灯.如何删除蓝灯?

我的清单:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sobreScrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="@android:color/transparent"
android:scrollingCache="false" 
android:fadingEdge="none"
android:fadingEdgeLength="0dp"
android:scrollbars="none"
android:scrollbarStyle="insideOverlay"  
    >    

    <LinearLayout
        android:id="@+id/contentSobre"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
Run Code Online (Sandbox Code Playgroud)

Java源代码:

package com.my.app.section;
import android.content.Context;
import android.util.AttributeSet; 
import com.my.app.BaseSection; 
import com.my.app.R;

public class SobreSection extends BaseSection {

public SobreSection(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
}

public SobreSection(Context context, AttributeSet attrs) {
    super(context, attrs);
}

public SobreSection(Context context) {
    super(context);
}

@Override
protected void onFinishInflate() {
    // TODO Auto-generated method stub
    super.onFinishInflate();

    findViewById(R.id.sobreScrollView).setVerticalFadingEdgeEnabled(false);
    findViewById(R.id.sobreScrollView).setVerticalScrollBarEnabled(false);

}
  }
Run Code Online (Sandbox Code Playgroud)

java xml android android-layout

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

编译器错误:"类,接口或枚举预期"

我已经对这个程序进行了几个小时的故障排除,尝试了几种配置,但没有运气.它是用java编写的,有33个错误(之前降低了50个)

源代码:

/*This program is named derivativeQuiz.java, stored on a network drive I have permission to edit
The actual code starts below this line (with the first import statement) */
import java.util.Random;
import java.Math.*;
import javax.swing.JOptionPane;
public static void derivativeQuiz(String args[])
{
    // a bunch of code
}
Run Code Online (Sandbox Code Playgroud)

错误日志(在JCreator中编译):

--------------------Configuration: <Default>--------------------
H:\Derivative quiz\derivativeQuiz.java:4: class, interface, or enum expected
public static void derivativeQuiz(String args[])
              ^
H:\Derivative quiz\derivativeQuiz.java:9: class, interface, or enum expected
    int maxCoef = 15;
    ^
H:\Derivative quiz\derivativeQuiz.java:10: class, interface, …
Run Code Online (Sandbox Code Playgroud)

java compiler-errors

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

文件写入器覆盖文件而不是附加到文件的麻烦

好的,我在将多行写入文本文件时遇到了一些麻烦.

程序运行,但每次都不会使用新行

当我想要它运行4次时,文本文件应如下所示:

a
b
c
d
Run Code Online (Sandbox Code Playgroud)

相反,它看起来像:

d
Run Code Online (Sandbox Code Playgroud)

谁知道如何解决这个问题?所有导入都已正确导入.

来源(经过轻微编辑,假设所有内容都已正确定义):

import java.io.*;
public class Compiler {
public static void main (String args[]) throws IOException
{
    //there's lots of code here
    BufferedWriter outStream= new BufferedWriter(new FileWriter("output.txt"));
    outStream.newLine();
    outStream.write(output);
    outStream.close();
}

}
Run Code Online (Sandbox Code Playgroud)

java file filewriter

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

比特流的压缩算法

我正在寻找一种很好的比特流压缩算法(数据包有效载荷压缩).我想避免基于符号概率的算法.我已经尝试过LZ系列算法,并且发现它们都没有用,即使使用BWT也是如此.

我试图将最小压缩百分比降低30%,但使用RLE只能达到3-5%.

什么是压缩率超过30%的好算法?

compression stream bit

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

跳过函数输入参数的复制构造函数的调试?

当一个步骤进入具有多个输入参数的调试函数时,进入和离开每个输入参数的复制构造函数是相当浪费时间的.通常情况下,这些复制构造函数是微不足道的(增加引用计数器),开发人员真正想要的是"直接进入函数 ",并跳过调试输入参数创建,无论是对复制文件的调用,或者调用创建参数对象实例的函数.

在Visual Studio中是否有办法以这种方式配置调试,以避免调试参数的构造/复制结构并直接进入函数体?

debugging visual-studio visual-c++

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

Java用特定字符更改字符串的一部分

我试图从点(a,b)获取String的一部分,并将字符串中给定值的字母替换为'X'.

示例:如果字符串是ABC123switch(3,5)被调用的,则会将其更改为ABCXXX.

到目前为止,我有:

  public void switch(int p1, int p2)
{
   String substring = myCode.substring(p1,p2-1);
}
Run Code Online (Sandbox Code Playgroud)

我很失落....感谢您的帮助!

java string methods replace substring

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

为什么为单例的静态变量赋值为nil

使用它有什么好处:

+ (CardPainter*) sharedPainter {
    static CardPainter* sp = nil;

    if (nil == sp) {
        sp = [[CardPainter alloc] init];
    }

    return sp;
}
Run Code Online (Sandbox Code Playgroud)

而不是这个:

+ (CardPainter*) sharedPainter {
    static CardPainter* sp = [[CardPainter alloc] init];

    return sp;
}
Run Code Online (Sandbox Code Playgroud)

静态变量初始化只执行一次,所以我看不到前者的优点.

null singleton static objective-c

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

对拒绝合作的Java代码进行故障诊断

名为"code"的字符串似乎无法读取.为什么这样,我该如何解决?

我的代码(导致问题的代码段):

String code;
for(int z = 0; z<x;z= z+0) // Repeat once for every character in the input string remaining
{
    for(int y=0;y<2;y++) //Repeat twice
    {
        c = (char)(r.nextInt(26) + 'a'); //Generate a random character (lowercase)
        ca = Character.toString(c);
        temp = code;
        code = temp + ca; //Add a random character to the encoded string
    }
Run Code Online (Sandbox Code Playgroud)

我的错误报告:

--------------------Configuration: <Default>--------------------
H:\Java\Compiler.java:66: variable code might not have been initialized
        temp = code;
               ^
1 error

Process completed.
Run Code Online (Sandbox Code Playgroud)

(我使用的是JCreator 5.00,Java 7.) …

java string

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