小编Cod*_*der的帖子

放射性组可以显示标题/标题吗?

我已经在我的应用程序上安装了一个带有三个单选按钮的无线电组,但是我希望文本在它上方,就像复选框一样.我可以像这样引用strings.xml文件吗?

   <RadioGroup
        android:id="@+id/set_radiogroup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/between_games_timer"
        android:orientation="vertical"
        android:text="@string/sets_radio_group" >

        <RadioButton
            android:id="@+id/one_set"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            </RadioButton>
        <RadioButton
            android:id="@+id/two_sets"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            </RadioButton>
        <RadioButton
            android:id="@+id/three_sets"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            </RadioButton>            
    </RadioGroup>
Run Code Online (Sandbox Code Playgroud)

因为当我运行应用程序时,三个单选按钮显示没有任何文本.或者有更简单的方法吗?

android

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

ArrayList .contain给出奇怪的输出

有谁能解释一下?我有一个带有字符串的arrayList.我正在使用!arraylist.contain以确保我不添加重复项.在下面的代码中,我显示了arraylist中的所有内容,然后检查arraylist中是否存在相同的值!arraylist.contain

public ArrayList<String> getIsiXhosaRecordings(ArrayList<String> must_download, ArrayList<String> all_filenames)
{
    database = getReadableDatabase();

    for(int x = 0; x < all_filenames.size(); x++)
    {
        System.out.println("All files: >>>"+all_filenames.get(x)+"<<<");
    }

    String[] table_names = {"Voice_exercise", "Lesson_exercise"};
    for(int x = 0; x < table_names.length; x++)
    {
        String SQL = "SELECT * FROM "+table_names[x];
        Cursor cursor = database.rawQuery(SQL, null);

        while(cursor.moveToNext())
        {
            String audio_isixhosa = cursor.getString(cursor.getColumnIndex("audio_isixhosa"));
            if(!all_filenames.contains(audio_isixhosa));
            {
                System.out.println("Audio file: >>>"+audio_isixhosa+"<<<");
            }
        }
    }
    return must_download;
}
Run Code Online (Sandbox Code Playgroud)

和logcat:

09-04 15:30:40.188: D/dalvikvm(14202): GC_CONCURRENT freed 65K, 9% free 9852K/10759K, paused 2ms+2ms, …
Run Code Online (Sandbox Code Playgroud)

java arraylist contain

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

更改单元格和字体的颜色

这是我第一次使用Google脚本。当行包含某些值时,我想更改行和文本的背景颜色。使用这段代码,我取得了一些成功:

function onEdit() 
{
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName('Sheet1');
  var rows = sheet.getRange('a1:z');
  var numRows = rows.getNumRows();
  var values = rows.getValues();

  for (var i = 0; i <= numRows - 1; i++)
  {
    var n = i+1;
    var backgroundColor;
    var textColor;

    if(values[i].indexOf('Won'))
    {
      backgroundColor = 'red';
      textColor = 'blue';
    }
    else if(values[i].indexOf('Lost'))
    {
      backgroundColor = 'green';
      textColor = 'yellow';
    }

    sheet.getRange('a'+n+':z'+n).setBackgroundColor(backgroundColor);    
    sheet.getRange('a'+n+':z'+n).setFontColor(textColor); 
  }
}
Run Code Online (Sandbox Code Playgroud)

因此,现在包含“ 获胜”的行变为带有黄色文本的绿色,而包含“ 丢失”的行则变为带有蓝色文本的红色。

几个问题:

  1. 每个空行也会变红-如何解决此问题?
  2. 我的if / else函数似乎被反转了,但是效果很好。我的理解是,如果该行包含“已赢”,则它实际上应该变成红色并带有蓝色文本。谁能帮助我更好地理解这一部分?

google-sheets gs-conditional-formatting

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