你指的导错是什么意思?
findViewById没错的。
解决方案 »
- 图片的放大缩小
- java 中关于map的赋值问题
- 请教 OExpress 视频显示的问题。
- Android game service SDK 1.0开发者文档
- NDK 应用第三方so包,找不到里面的方法
- 小弟菜鸟,请教Gallery相册问题
- 关于Android中ImageButton的文字显示问题
- 有图,求真相!!ubuntu下编译好ffmpeg.so,放到eclipse 下编译项目,生成apk中的ffmpeg.so变小了(由ubuntu下的7M变成1M)
- 安卓求解~
- AS&Unity交互问题
- android本地api文档打不开是几个意思,官网也老是打不开,有木有大神知道
- 请问如何将onActivityResult得到的数据更新在alertdialog上
你指的导错是什么意思?
findViewById没错的。看看R文件 是不是你这个项目的 就是类最上面的import
如果是自己项目的R 那就 project-clean 选中自己项目 clean一下
<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="me.softlmis.phone.MainActivity"
tools:ignore="MergeRootFrame" />
<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="me.softlmis.phone.MainActivity$PlaceholderFragment" > <Button
android:id="@+id/bt_Num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="52dp"
android:text="@string/dail" />
再将bt改回bt_Num,然后保存一下。
应该就可以了
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
将以上代码改为
setContentView(R.layout.fragment_main);
2、如果view是定义在fragment里面,参照:http://blog.csdn.net/enson16855/article/details/27339947
应该就是main页面没有f页面的元素,所以才找不到。看了帖子,谢谢你了。