小编Edm*_*jas的帖子

C#找到最高的数组值和索引

所以我有一个未排序的数值数组int[] anArray = { 1, 5, 2, 7 };,我需要得到数组中最大值的值和索引,这将是7和3,我该怎么做?

c# arrays indexing

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

Android如何通过支持actionbar获取AppCompat.Translucent类型主题?

我想将支持操作栏添加到我的一个活动中,我之前一直在使用theme.translucent和这个活动,但是为了使支持actionbar工作我需要继承Theme.AppCompat,我需要保持半透明这个活动的主题,但不幸的是,我没有默认情况下可以看到的Theme.AppCompat.translucent,有什么方法可以做到这一点?

android android-theme android-actionbar android-actionbar-compat

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

以编程方式在android中设置编辑文本提示?

有没有办法用java设置在android edittext中显示的文本提示?我希望我的应用程序能够在不同的时间在edittext中显示不同的内容,提前感谢

java android android-edittext

39
推荐指数
5
解决办法
6万
查看次数

Android scrollview隐藏布局中的顶级内容

我有一个问题,其中android scrollview开始隐藏我在我的布局顶部的一对textview,我发现在这个网站上有另一个人有这个问题,并能够得到帮助不幸的是,帮助他们的人实际上没有说什么修复它,谁能告诉我这里的修复是什么?

android scrollview隐藏顶级内容

任何帮助都很大这里是我的xml代码:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/title_color_dark_transparent" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_vertical|center_horizontal|center"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="5dp"
        android:orientation="vertical"
        android:paddingTop="5dp" >

        <TextView
            android:id="@+id/saysomething"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/loading"
            android:textColor="#FFFFFF"
            android:textSize="30dp" />

        <TextView
            android:id="@+id/saysomethinginfo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:text="@string/loading"
            android:textColor="#FFFFFF"
            android:textSize="17dp" />

        <EditText
            android:id="@+id/tweetedittext"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/edit_text"
            android:gravity="top"
            android:hint="@string/edittext_hint"
            android:inputType="textCapSentences|textMultiLine|textAutoCorrect|textAutoComplete"
            android:lines="3"
            android:textAppearance="@style/TextAppearance.EditText"
            android:textSize="17dp" />

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:layout_marginTop="5dp"
            android:orientation="horizontal" >

            <Button
                android:id="@+id/photobutton"
                style="@style/TextAppearance.Button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_background"
                android:onClick="photobuttonClicked"
                android:text="@string/photobuttontext"
                android:textSize="15dp" />

            <TextView
                android:id="@+id/charactersremaining"
                android:layout_width="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-xml android-scrollview

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

java比较器,如何按整数排序?

我试图在java中学习比较器,我在网上找到了这个很好的例子,我的问题是如何更改这些代码,以便按年龄和降序排列宠物名称,以便最老的是第一个,最小的是最后一个?

class Dog implements Comparator<Dog>, Comparable<Dog>{
private String name;
private int age;
Dog(){
}

Dog(String n, int a){
  name = n;
  age = a;
}

public String getDogName(){
  return name;
}

public int getDogAge(){
  return age;
}

// Overriding the compareTo method
public int compareTo(Dog d){
  return (this.name).compareTo(d.name);
}

// Overriding the compare method to sort the age 
public int compare(Dog d, Dog d1){
  return d.age - d1.age;
}
}

public class Example{
public static void main(String args[]){
  // Takes …
Run Code Online (Sandbox Code Playgroud)

java android sql-order-by comparator

35
推荐指数
4
解决办法
15万
查看次数

正则表达式模式匹配url有或没有http:// www

我根本不擅长正则表达式.

我已经使用了大量的框架代码到今天为止,但我无法找到一个可以媲美像一个URL http://www.example.com/etcetc也能赶上像www.example.com/etcetcexample.com/etcetc.

任何帮助都会很棒.多谢你们!

php regex

33
推荐指数
4
解决办法
7万
查看次数

如何将android中的堆转储转换为eclipse格式

我试图分析一直让我疯狂数周的内存泄漏,我发现了eclipse MAT工具可以帮助你弄清楚什么是错的,问题是我发现的每一个教程都说我需要转换格式从dalvik到HPROF格式的文件 ,但是我找不到一个单独的教程解释了如何实际做到这一点,而是我得到了这样模糊的东西

现在您将获得的文件不符合"标准"Sun .hprof格式,但是以Dalvik自己的格式编写,您需要将其转换为:

hprof-conv heap-dump-tm-pid.hprof 4mat.hprof

这究竟意味着什么?我点击什么?我要去哪?我完全迷失和沮丧,任何帮助都会走很长的路,谢谢.

eclipse android heap-dump mat

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

android getRelativeTimeSpanString()bug?

getRelativeTimeSpanString()在android中使用内置方法DateUtil我无法得到"几分钟前""几天前"等时间文件说我应该收到的时间已过,而我得到的结果只是以这样的方式显示实际日期"可能12 2010",不知道这是否是一个错误或什么,但我用尽既getRelativeTimeSpanString (long time, long now, long minResolution)getRelativeTimeSpanString (long startTime),双方只返回变量的实际日期"很长一段时间"

这是我的代码

private void setJoineddate() {
    Date currentDate = new Date();
    long currentDateLong = currentDate.getTime();
    long oldDate = join_date.getTime();

    CharSequence relativeTime = DateUtils
                         .getRelativeTimeSpanString(oldDate, currentDateLong, 0);
    joindate.setText(relativeTime);

}
Run Code Online (Sandbox Code Playgroud)

java datetime android

14
推荐指数
2
解决办法
8186
查看次数

Android Linkify如何设置自定义链接颜色?

我想将我的android linkify文本颜色设置为自定义颜色,但mText.setLinkTextColor("#2f6699");不起作用,我一直在寻找一个内置的方法,将编译一个十六进制的值,但我还没找到一个,任何帮助将有很长的路要走

android textcolor linkify

13
推荐指数
2
解决办法
8392
查看次数

android textureview全屏预览,正确的宽高比

我一直在使用谷歌camera2 api演示,不幸的是,示例应用程序是为了在屏幕高度的大约70%处显示纹理视图预览,在环顾四周之后,我能够确定这是由AutoFitTextureView覆盖了onMeasure()方法如下图所示:

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    int width = MeasureSpec.getSize(widthMeasureSpec);
    int height = MeasureSpec.getSize(heightMeasureSpec);
    if (0 == mRatioWidth || 0 == mRatioHeight) {
        setMeasuredDimension(width, height);
    } else {
        if (width < height * mRatioWidth / mRatioHeight) {
            setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
        } else {
            setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我尝试通过设置正确的高度和宽度来纠正这个setMeasuredDimension(width, height);问题,这解决了高度问题,并从纹理视图中给我一个全屏预览,但是在每个设备上宽高比完全被破坏和翘曲,标准的固定方式是什么这个?我看到很多应用程序在Play商店找到了解决这个问题的方法,但还没能找到解决方案,任何帮助都会有很长的路要走,谢谢.

java android android-camera android-textureview android-camera2

13
推荐指数
2
解决办法
5279
查看次数