处理空列表
16lz
2022-05-24
<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" android:background="#ffe1e0de" > <ListView android:id="@+id/listview" android:layout_width="match_parent" android:layout_height="match_parent" > </ListView> <ImageView android:id="@+id/imageview" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/icon" /></RelativeLayout>
java代码:
import com.example.test.Test1.R;import android.app.Activity;import android.os.Bundle;import android.widget.ListView;public class HelloAndroidActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView listView = (ListView)findViewById(R.id.listview); listView.setEmptyView(findViewById(R.id.imageview)); }}
更多相关文章
- Android(安卓)相机实例(一)
- Flutter知识点:数据存储之File
- android 用代码编写linearlayout布局
- Android实现应用下载并自动安装apk包
- 编写android拨打电话apk应用实例代码
- android计算器简单版【安卓进化一】
- Android中和service进行本地通讯
- 分享一段Android基于https协议POST数据的代码
- android 软键盘回车变搜索