我想改变Horizontal
ProgressBar
颜色
我试过这个
它不能正常运行蓝色
这是我的代码
<ProgressBar
android:id="@+id/mini_progress"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="20dip"
android:layout_gravity="center_horizontal"
android:indeterminate="false"
android:indeterminateBehavior="repeat"
android:indeterminateOnly="true"
android:visibility="gone"/>
Run Code Online (Sandbox Code Playgroud)
我怎么能把颜色变成粉红色?
在我发布这个帖子之前,我已经google了(如何设置listview项目的样式)我找不到一个很好的例子来展示如何设置listview项目(正常,触摸,长按等)背景颜色我也想做这样的VK listview有边框半径和框阴影,请我真的需要这个帮助,其他人搜索这个是有任何例子或可以有人告诉我,我必须把项目的xml选择器背景放入?
图像一显示如何列表视图项具有边框半径和阴影
当我点击该项目时显示的图像2
那么伙计们有没有办法这样做?
即使我的应用程序已关闭,我也试图在Android通知栏中显示通知.
我试过搜索,但我没有找到帮助的运气.
一个例子是新闻应用程序.即使手机屏幕关闭或新闻应用程序关闭,它仍然可以发送最近新闻的通知并将其显示在通知栏中.
我如何在自己的应用程序中执行此操作?
我的应用程序中有一个API类; 例如,在API类中,有一个自定义字体已设置为静态
public static Typeface font_short;
@SuppressWarnings("deprecation")
public Api(Context c , Display d)
{
this.context = c ;
//I want to change this if user wants to keep using System font style or my custom style
if ( keep_curren == true )
{
font_title = //What to add here to get Default fonts Typeface
}else
//use my costume font
{
font_title = Typeface.createFromAsset(context.getAssets(),"fonts/custome.ttf");
}
display = d;
w = display.getWidth(); // deprecated
h = display.getHeight(); // deprecated
}
Run Code Online (Sandbox Code Playgroud)
如果用户不想使用我的自定义字体,我想获取设备的默认和当前Typeface!
在活动类中 …
我试图在单元格之间留出空间UItableview
我已经检查了谷歌我发现的所有帖子都超过3年,当我尝试应用它们时我得到了这么多错误,是否有可能在单元格之间留出空间UItableview
?
我的代码:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "ImageCell") as! ImageCell
cell.model = self.modelAtIndexPath(indexPath)
let url = URL(string: cell.model.imageName)
cell.imgBack.kf.setImage(with: url)
return cell
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
//send back playlist count
if (section == 0) {
return self.lists_arr.count
}
return 0
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated:true)
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, …
Run Code Online (Sandbox Code Playgroud) 我正在为我的项目开发一个SEO系统,并用一个页面优化所有链接.
.htaccess
文件摘录:
RewriteRule ^(.+)$ seo.php [L,QSA]
Run Code Online (Sandbox Code Playgroud)
这个SEO文件(seo.php
)将获取请求的路径并将其解析为我的脚本中的有效URL.
我include('cat.php?catid=1')
在最后使用,seo.php
一切都很好,但我想知道哪个更快:include()
或者file_get_contents()
?
当我使用file_get_content('cat.php?catid=1')
它时,它显示PHP文件的来源,但是当我使用file_get_content('http://localhost/cat.php?catid=1')
它时,它显示正常页面.
那么,哪个更快:file_get_content()
或者include()
?
我制作了一个文件用W打印出图像文件,我用get方法定义
但我的问题是缓存这些图片
我将此标题添加到文件中
@header("Cache-Control: private, max-age=10800, pre-check=10800");
@header("Pragma: private");
@header("Expires: " . date(DATE_RFC822,filemtime($full_path)));
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])
&&
(strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == filemtime($full_path))) {
// send the last mod time of the file back
header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($full_path)).' GMT',true, 304);
exit;
}else
{
@header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($full_path)) . ' GMT');
@header('Content-Type: image/jpeg');
@imagejpeg($image);
}
Run Code Online (Sandbox Code Playgroud)
但我的问题是一些图片缓存好,但其他人没有,有时候相册内的图片不会出现,直到我禁用缓存头
我的标题是正确的吗?,关于缓存我必须使用 - 或+设置时间缓存如何工作?
我的代码有问题,但我不知道E日志报告在哪里
04-08 05:47:46.745: E/Upload Server(20080): Starting : /storage/sdcard1/Music/Piano (my favourites)/11 Tchaikovsky - The Music Lovers.mp3
04-08 05:47:47.136: E/Upload Server(20080): Connection Error : sendto failed: EPIPE (Broken pipe)
Run Code Online (Sandbox Code Playgroud)
什么是(EPIPE)?,当我尝试上传图像时,其上传成功,但任何其他文件E Cat报告(断管)为什么!
这是我的上传代码
@Override
protected String doInBackground(String... urls) {
String upLoadServerUri = "http://test.com/test.php";
String fileName = this.file_path;
HttpURLConnection connection = null;
DataOutputStream outputStream = null;
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
int maxBufferSize = 1*1024*1024;
File sourceFile = new File(fileName);
int …
Run Code Online (Sandbox Code Playgroud) 目标根本不能阻止 httpClient
和httpget
当我点击进度对话框cancel
按钮Request
和AsyncTask
应停止和终止,但它不是,请求仍在运行,直到其完成
这是我的AsyncTask
测试代码
public class getAlbuminfo extends AsyncTask<String,String, String> {
ProgressDialog progressDialog;
JSONObject data = null;
boolean prependMore = false;
//Http
HttpClient httpClient;
HttpGet httpget;
/**********
* Begien
*/
@SuppressWarnings("deprecation")
@Override
protected void onPreExecute() {
if ( onlypagenat == false )
{
progressDialog = new ProgressDialog(context);
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(true);
progressDialog.setMessage(context.getResources().getString(R.string.opening_album));
progressDialog.setButton(context.getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
cancel(true);
finish();
}});
progressDialog.show();
}
prependMore = appendMore;
appendMore …
Run Code Online (Sandbox Code Playgroud) 我感到有点困惑什么是最快和与服务器进行信息发布或通过AJAX从服务器获取友好的方式,是jQuery的($.load()
,$.get()
,$.post()
,$.ajax()
)或Javascript XMLHttpRequest的一样?
我需要在我的项目中创建一个函数或类来通过AJAX从服务器调用请求,但我不知道服务器jQuery或Javascript更快更友好.
我正在寻找最简单的方法来关闭x分钟后打开的活动.android提供倒计时课程还是我必须自己做一个?
我试过这段代码,但它不起作用
Thread isOnDisplayThread = new Thread(new Runnable() {
@Override
public void run() {
Timer mTimer = new Timer();
mTimer.schedule(new TimerTask() {
@Override
public void run() {
Log.d(TAG, (isApplicationOnDisplay) ? "Application on display" : "APPLICATION ON BACKGROUND");
if (!isApplicationOnDisplay) {
notOnDisplayTime++;
if (notOnDisplayTime >= 10) {
Process.killProcess(Process.myPid());
}
} else {
notOnDisplayTime = 0;
}
}
}, 0, 1000);
}
});
isOnDisplayThread.run();
Run Code Online (Sandbox Code Playgroud) 旨在开发一个小应用程序来获取最新文章并展示它们 notifications bar
我知道设置service
foreground
它杀死电池和设备内存的坏主意
而且正如我们所知,有一些应用程序每x分钟就会杀死所有正在运行的服务,例如advanced task killer
我的服务也已经被杀死,所以在用户再次午餐之前,目的不是获取最新消息
我用谷歌搜索了如何防止我的服务被杀,我找不到一个好的解决方案,他们大多数都太老了,其余的都没用
我真的需要一个建议是否有任何方法可以防止我的服务被杀死没有foreground
?
非常非常感谢任何帮助