解决方案 »
- 为什么安卓能得到大键盘的键值,却不能得到小键盘的键值
- 新手求助,如何获得GridView中的各个元素
- 关于ProgressDialog的问题
- 环境变量必须配吗?eclipse的版本会影响模拟器吗?
- android代码中是怎样调用输入法的,具体在哪位置,谢谢!
- 墨迹天气 天气效果怎么实现
- 新建刷机包,怎么定制指定机型的刷机包;
- 如何修改Android源码实现手机恢复出厂设置后,语言总为中文
- the application has stopped unexpectedly
- 请问 有谁清楚京东、淘宝APP是否使用HTML5
- 求助 谁写过android疯狂讲义最后的那个电子拍卖系统啊?
- EditText光标的问题
public int getCount() {
// TODO Auto-generated method stub
return 0;
} @Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
} @Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
} @Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
return null;
}
}
AndroidManifest.xml内容如下,应该是注册了的
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dailytimetracker"
android:versionCode="1"
android:versionName="1.0" > <uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" /> <application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.dailytimetracker.TimeSchedulerActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application></manifest>
..亲,你注释了setadapter后不报错,因为你没有引用那个adapter.所以我跟你说你的baseadapter写错了
报错是因为listview为null而非adapter
1. findViewById在setContentView(R.layout.main);之前.
2. 使用了id的旧风格 <Button id="@+id/btn_ok" />
3. 没有重写BottomTab方法
4. .clean一下工程,让ID重新生成
5. 在另一个view的元素应该用baseView.findViewById()来拿还有这样的提示:
1、对于一个没有被载入或者想要动态载入的界面,都需要使用LayoutInflater.inflate()来载入;
2、对于一个已经载入的界面,就可以使用Activiyt.findViewById()方法来获得其中的界面元素。我遇到的问题可能是上面的第五条,也可能是下面的两条,但是刚接触Androiad,实在是搞不清楚,贴出我的layout文件如下,有劳大家帮看看activity_time_scheduler.xml<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.dailytimetracker.TimeSchedulerActivity"
tools:ignore="MergeRootFrame" />
fragment_time_scheduler.xml<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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.dailytimetracker.TimeSchedulerActivity$PlaceholderFragment" >
<TextView
android:id="@+id/text_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/title_str" /> <ListView
android:id="@+id/time_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/text_title"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/text_title" > </ListView></RelativeLayout>time_list_item.xml<?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="wrap_content"
android:orientation="vertical" >
<TextView android:id="@+id/time_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:paddingBottom="5dp" />
<TextView android:id="@+id/notes_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12sp" />
</LinearLayout>
android:id="@+id/text_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/title_str" />
大家忽略掉,那是我加上用来调试的
谢谢,Fragment确实还不是太懂,我查一下具体是怎么用,不懂的东西太多了