Android 应用程序崩溃:viewpager
有人能告诉我,如果我在同一个xml文件中放入带有viewpager的内容,为什么我的应用程序会崩溃。谢谢Android 应用程序崩溃:viewpager,android,android-viewpager,Android,Android Viewpager,有人能告诉我,如果我在同一个xml文件中放入带有viewpager的内容,为什么我的应用程序会崩溃。谢谢 <?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_
<?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">
<com.example.g514110.com.SlidingTabLayout
android:id="@+id/sliding_tabs"
android:background="#ddd"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1"
android:background="@android:color/white"/>
</LinearLayout>here
在这里
或者将android:weightSum
添加到你的linaer布局中,或者将你的viewpager的高度增加到它缺失的位置问题解决了!!我把xml文件中的“com.example.g514110.com.SlidingTabLayout”搞错了实际上它不是“com.example.g514110.com.SlidingTabLayout”,而是“com.example.g514110.ihmslidingtabs.SlidingTabLayout”。非常感谢 请添加您收到的错误/崩溃消息。设置高度而不是0px。。包裹或匹配。。然后取下电线。。在这种情况下,将高度设置为在启动时匹配。我发现“不幸的是,应用程序已经停止”仍然是同样的问题。一旦启动,应用程序将停止。com.example.g514110.com.SlidingTabLayout是否正确是的!!谢谢