如何禁用Android应用中特定按钮的点击声?
这是我的代码:
more1after.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
sc.scrollTo(sc.getScrollX() + 75,
sc.getScrollY() + sc.getWidth() + 5);
}
});
Run Code Online (Sandbox Code Playgroud) 我想绘制一个表,其中最后一列应位于表的最右侧.
这是表行的样子:
Admin (2)New
Network (2)New
Run Code Online (Sandbox Code Playgroud)
这应该是这样的:
Admin (2) New
Network (2) New
Run Code Online (Sandbox Code Playgroud)
XML:
<?xml version="1.0" encoding="utf-8"?>
<!-- row.xml -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="45dp"
android:gravity="center" android:background="@color/list_bg">
<TableLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow>
<ImageView android:id="@+id/t1" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView android:id="@+id/t2" android:typeface="normal"
android:singleLine="true" android:textSize="14sp" android:textStyle="normal"
android:layout_width="wrap_content" android:textColor="#000000"
android:layout_height="wrap_content" />
<TextView android:id="@+id/t10" android:typeface="normal"
android:singleLine="true" android:text=" " android:textSize="14sp"
android:textStyle="normal" android:layout_width="wrap_content"
android:textColor="#000000" android:layout_height="wrap_content" />
<TextView android:id="@+id/t4" android:typeface="normal"
android:visibility="gone" android:singleLine="true" android:text="("
android:textSize="14sp" android:textStyle="normal"
android:layout_width="wrap_content" android:textColor="#000000"
android:layout_height="wrap_content" />
<TextView android:id="@+id/t5" android:typeface="normal"
android:visibility="gone" android:singleLine="true"
android:textSize="14sp" android:textStyle="normal"
android:layout_width="wrap_content" android:textColor="#000000"
android:layout_height="wrap_content" /> …Run Code Online (Sandbox Code Playgroud) 我收到了这个错误
Description Resource Path Location Type
Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder! Sample1 Unknown Android Packaging Problem
Run Code Online (Sandbox Code Playgroud)
在一段时间之前它对我来说工作正常,我认为由于某些病毒或我的设置受到影响,请帮我这个???
我想用 POST 方法调用一个休息网络服务。下面是我需要传递的服务 url 及其参数
Rest Service: https://url/SSOServer/SSO.svc/RestService/Login
Json Object {"ProductCode":"AB","DeviceType":"android Simulator","UserName":"","ModuleCode":"AB_MOBILE","DeviceId":"device-id","Version":"1.0.0.19","CustomerCode":"w","Password":""}
Run Code Online (Sandbox Code Playgroud)
这是我的帖子请求代码:
public void sendHttpPost() throws ClientProtocolException, IOException{
HttpPost httpPostRequest = new HttpPost(url + buildParams());
// add headers
Iterator it = headers.entrySet().iterator();
Iterator itP = params.entrySet().iterator();
while (it.hasNext()) {
Entry header = (Entry) it.next();
httpPostRequest.addHeader((String)header.getKey(), (String)header.getValue());
}
HttpClient client = new DefaultHttpClient();
HttpResponse resp;
resp = client.execute(httpPostRequest);
this.respCode = resp.getStatusLine().getStatusCode();
Log.i(TAG, "response code: " + getResponseCode());
this.responsePhrase = resp.getStatusLine().getReasonPhrase();
Log.i(TAG, "error msg: " + getErrorMsg());
HttpEntity entity = resp.getEntity(); …Run Code Online (Sandbox Code Playgroud) 我正在开发一款安卓游戏.
它工作正常,但我有一个问题,如果我从我android manifest的应用程序图标删除下面的行是可见的.如果我不删除这些行,那么我的应用程序图标在我的android上不可见.
<data android:host="mocha" android:path="/RTT/reset"
android:scheme="content" />
Run Code Online (Sandbox Code Playgroud)
这是我的原始Android清单,其中的图标不可见:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ihpc.mocha.rtt"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="12" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:name="com.game.rtt.RttGame"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@android:style/Theme.NoTitleBar" >
<activity
android:screenOrientation="sensorLandscape"
android:name=".MainScene"
android:label="@string/title_activity_main_scene" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!-- remove below lines to visible the icon start!!!-->
<data
android:host="mocha"
android:path="/RTT/reset"
android:scheme="content" />
<!-- remove below lines to visible the icon end!!!-->
</intent-filter>
</activity>
<activity
android:name=".SessionTimeOutActivity"
android:label="@string/app_name"
android:screenOrientation="reverseLandscape">
<intent-filter>
<action …Run Code Online (Sandbox Code Playgroud) 我想在SQLite数据库日期时间类型字段中插入当前日期.我怎样才能做到这一点?
更新:使用mDb.execSQL("INSERT INTO " + DATABASE_TABLE + " VALUES (datetime()) ");
我能够插入喜欢date_created=2012-10-10 13:02:08,我希望这种格式10 Oct 2012 12:48如何实现这一点?
我正在研究java中的多线程并创建1个线程,这里是代码:
class SampleThread extends Thread
{
int time;
String name;
boolean autocall;
public SampleThread(int time, String name)
{
this.time = time;
this.name = name;
}
public void run()
{
try{
time = time +1;
updateView(time, name);
//sleep(3000);
}catch(Exception e)
{
e.printStackTrace();
}
//this.stop();
}
}
Run Code Online (Sandbox Code Playgroud)
现在我想每隔3秒运行一次这个线程如何实现这个?
我有java util date Thu Feb 28 15:35:00 GMT+00:00 2013
如何将其转换为HH:MM.
我试图通过下面的代码片段来做到这一点:
SimpleDateFormat formatter = new SimpleDateFormat("HH:MM");
formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
return formatter.format(objDate);
Run Code Online (Sandbox Code Playgroud)
它给出了正确的结果,dd mmm但总是给出02分钟HH:MM
请告诉我这个功能有什么问题?
在我的应用程序中我得到数据库被锁定.
我尝试使用其他帖子中提供的解决方案,但找不到合适的解决方案,这就是我发布此问题的原因.
这是onCreate
DBAdapter db = new DBAdapter(this.getApplicationContext());
dialoge = new Progress_Dialog(this);
dialoge.setCancelable(false);
try {
db.createDataBase();
} catch (IOException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
这是create database方法
public void createDataBase() throws IOException{
boolean dbExist = checkDataBase();
if(!dbExist){
this.getReadableDatabase();
try {
copyDataBase();
} catch (IOException e) {
e.printStackTrace();
throw new Error("Error copying database");
}
}
}
Run Code Online (Sandbox Code Playgroud)
以下是checkdatabase方法
private boolean checkDataBase(){
SQLiteDatabase checkDB = null;
try{
String myPath = DB_PATH + DB_NAME;
String myPath2 = DB_PATH + DB_NAME2;
checkDB = SQLiteDatabase.openDatabase(myPath, null,
SQLiteDatabase.OPEN_READWRITE);
if(checkDB …Run Code Online (Sandbox Code Playgroud) 我试图显示一个列表,我使用了一个类Ios.java
public class Ios extends Activity implements OnItemClickListener,OnClickListener
{
list=(ListView) findViewById(R.id.list);
list.setOnItemClickListener(this);
String DATA[] = {"io1","io2","io3","io4","io5"};
IosListAdapter obj = new IosListAdapter(this.getApplicationContext()
,R.layout.row, DATA);
list.setAdapter(obj);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
// TODO Auto-generated method stub
}}
Run Code Online (Sandbox Code Playgroud)
我的自定义适配器如下:
public IosListAdapter(Context con, int rid,String[] dATA) {
// TODO Auto-generated constructor stub
this.con = con;
this.DATA = dATA;
this.rid = rid;
}
@Override
public …Run Code Online (Sandbox Code Playgroud)