对于另一个活动中的另一个listView,项目的文本颜色是黑色的,就像它应该的那样.但是,在另一个活动中,当新项目创建时,在新线程中使用setAdapter时,如果我想要黑色,则文本颜色为白色.以下是Layout和Java代码的内容:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="project.yemeb.Search"
android:background="#ffffffff">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="100dp"
android:background="@drawable/back_web"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:id="@+id/relativeLayout"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Search"
android:id="@+id/button2"
android:background="#ffffffff"
android:onClick="onBtnClick"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText"
android:layout_alignBottom="@+id/button2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="#ffffffff"
android:layout_toLeftOf="@+id/button2"
android:layout_toStartOf="@+id/button2"
android:layout_alignTop="@+id/button2" />
</RelativeLayout>
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView"
android:layout_alignParentBottom="true"
android:layout_below="@+id/relativeLayout"
android:headerDividersEnabled="false" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
Java代码:
package project.yemeb;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus; …Run Code Online (Sandbox Code Playgroud) 这是我与 PeerJS 连接的代码:
var peer = new Peer({ key: '[PeerJSID]', debug: 3});
peer.on('open', function(){
$('#my-id').text(peer.id);
});
// Receiving a call
peer.on('call', function(call){
// Answer the call automatically (instead of prompting user) for demo purposes
call.answer(window.localStream);
step3(call);
});
peer.on('error', function(err){
alert(err.message);
// Return to step 2 if error occurs
step2();
});
// Click handlers setup
$(function(){
$('#make-call').click(function(){
// Initiate a call!
var call = peer.call($('#callto-id').val(), window.localStream);
step3(call);
});
$('#end-call').click(function(){
window.existingCall.close();
step2();
});
// Retry if getUserMedia fails
$('#step1-retry').click(function(){
$('#step1-error').hide();
step1();
}); …Run Code Online (Sandbox Code Playgroud) 这是我的代码:
use std::ptr;
struct Query<T>{
data: T,
prev: & Query<T>,
next: & Query<T>,
}
impl<T> Query<T>{
fn new(name: T) -> Query<T>{
Query{
data: name,
prev: ptr::null(),
next: ptr::null(),
}
}
}
Run Code Online (Sandbox Code Playgroud)
我一直在引用'缺少生命周期说明符' &Query<T>.我该如何解决这个错误?
我正在尝试使用我的应用程序创建一个解释器类型的东西,其中一个来自服务器上的文件的字符串被获取并且它被分解为偶数.这是代码:
public void onBtnClick(View view)
{
final String message = ((EditText) findViewById(R.id.editText)).getText().toString();
final String mes = message.replace(".meb", "");
final TextView urlTextOut = (TextView) findViewById(R.id.URLtextView);
final ScrollView linearLayout = (ScrollView) findViewById(R.id.setscroll);
new Thread() {
StringBuilder text = new StringBuilder();
@Override
public void run() {
try
{
String str = "";
URL url = new URL("http://awsomisoft.com/" + mes + "/" + mes + ".meb");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
while ((str = in.readLine()) != null) {
text.append(str);
}
in.close();
} catch …Run Code Online (Sandbox Code Playgroud) 所以,我有一个具有自己类的文件层次结构。下面是一个例子:
mod query;
struct Row<T>{
data: Vec<Query<T>>,
}
impl<T> Row<T>{
fn new(array: Vec<Query<T>>) -> Row<T>{
Row{
data: array,
}
}
}
Run Code Online (Sandbox Code Playgroud)
虽然它说文件在那里,但它说“查询是一种未声明的类型”,即使它存在于另一个文件中。当所有内容都在同一个文件中时,代码有效。
android ×2
rust ×2
audio ×1
items ×1
javascript ×1
lifetime ×1
listview ×1
peerjs ×1
scrollview ×1