我正在设置一个TextView
id,@android:id/empty
以便在没有项目时显示消息ListView
.但是,TextView
即使ListView
在项目出现之前有项目,也会显示此信息.
我怎样才能使它只在没有元素时显示ListView
?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:dividerHeight="1dp" >
</ListView>
<TextView
android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/empty_list" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
PS:我正在使用a Loader
和SimpleCursorAdapter
a ListFragment
.
我不得不重新安装我的系统,今天当我尝试与gradle同步时,我在Android Studio中收到此错误:
Warning: Unable to find optional library: org.apache.http.legacy
Run Code Online (Sandbox Code Playgroud)
我的项目是:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Run Code Online (Sandbox Code Playgroud)
我的模块是gradle:
apply plugin: 'android'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
}
buildTypes {
release {
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
}
Run Code Online (Sandbox Code Playgroud)
要继续使用Apache HTTP API,必须首先在build.gradle文件中声明以下编译时依赖项:
Run Code Online (Sandbox Code Playgroud)android { useLibrary 'org.apache.http.legacy' } …
我有一个ListView
我想要启用批量选择的.对于Android 3.0及以上版本,我添加了一个模态多选项ListView
并设置了多选模式监听器.
如何为3.0之前的Android版本(有或没有第三方库)做同样的事情?我看过ActionBarSherlock,但我没有在任何样本中找到此功能,也没有在网上搜索信息.
PS:当用户点击ListView
我想要执行不同操作的项目时,需要长按批次选择(或单个项目选择).
3.0之前的版本可以追溯到API 7.
我在C中实现了一些基本的数据结构,我发现如果我从函数中省略了返回类型并调用该函数,则编译器不会生成错误.我编译cc file.c
并没有使用-Wall
(所以我错过了警告)但在其他编程语言中这是一个严重的错误,程序将无法编译.
根据Graham Borland的要求,这是一个简单的例子:
int test()
{
printf("Hi!");
}
int main()
{
test();
}
Run Code Online (Sandbox Code Playgroud)