我只是尝试通过添加scrollview添加滚动浏览此布局的功能,但每次我尝试加载布局时,我都会收到一条错误,指出"java.lang.IllegalStateException:ScrollView只能托管一个直接子项",我不确定为什么.
任何建议都非常感谢.
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<RelativeLayout>
<View
android:layout_width="1dp"
android:layout_height="5dp" >
</View>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<com.google.android.youtube.player.YouTubePlayerView
android:id="@+id/youtubeplayerview"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<View
android:layout_width="1dp"
android:layout_height="5dp" >
</View>
<TextView
android:id="@+id/textView1a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Isaac Daniel at CNN Anderson Cooper"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/textView2a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="by idconex"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/textView3a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="675,000,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
<com.google.android.youtube.player.YouTubePlayerView
android:id="@+id/youtubeplayerview2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textView1b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rage Against The Machine - Bulls on Parade"
android:textAppearance="?android:attr/textAppearanceMedium" …Run Code Online (Sandbox Code Playgroud) 尝试将可滚动导航栏添加到屏幕底部时出现两个错误.我以前从未见过这个错误,到目前为止我找到的答案似乎没有解决我遇到的问题.
error: No resource identifier found for attribute 'layout_alignParentCenter' in package 'android' home.xml /idg/res/layout line 298 Android AAPT Problem
error: No resource identifier found for attribute 'layout_alignParentCenter' in package 'android' home.xml /idg/res/layout line 361 Android AAPT Problem
Run Code Online (Sandbox Code Playgroud)
任何输入都非常感谢.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- The main content view -->
<LinearLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<!-- The rest of your layout (TextView, ScrollView, etc) -->
</LinearLayout>
<!-- The navigation drawer -->
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp" …Run Code Online (Sandbox Code Playgroud)