【发布时间】:2015-06-16 15:05:34
【问题描述】:
让我的 ScrollView 正常运行时遇到了很多麻烦。我正在使用主细节设计。大师滚动,因为它是一个列表视图。当 Activity 在消失之前被充气时,选择的 Detail 将显示在我的 XML 中实现的滚动条几秒钟(Stackoverflow 不允许我发布错误的屏幕截图,因为这是我的第一篇帖子)
当我尝试使用触摸输入滚动 Detail Activity 时,没有任何反应。我尝试将 Mel 的解决方案复制并粘贴到 ScrollView doesn't work 的帖子中看似相同的问题。对于父级、子级和 ScrollView 本身,我还尝试了所有可能的 match_parent 和 fill_parent 组合。任何帮助表示赞赏。我的 XML 代码如下:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fillViewport="true"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linearLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:layout_marginTop="20dp"
android:stretchColumns="1, 2"
>
<ImageView
android:id="@+id/picture"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:src="@drawable/bmp1"
android:layout_alignParentTop="true"
/>
<TableLayout
android:id="@+id/tableLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_marginTop="20dp"
android:stretchColumns="1, 2">
<!-- Table Row 0 -->
<TableRow
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/tableRow0">
<TextView
android:id="@+id/priWeapon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/priWeapon" android:textColor="#000" android:textStyle="bold"
android:gravity="left"
android:padding="5dp"/>
<EditText
android:id="@+id/priWeaponEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/NA" android:textSize="14sp" android:textStyle="bold"
android:gravity="center"
android:focusable="false"
android:layout_weight="1"
android:cursorVisible="false"
android:longClickable="false"/>
</TableRow>
<!-- Table Row 1 -->
<TableRow
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/tableRow1">
<TextView
android:id="@+id/priWeaponRange"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/priMaxRange" android:textColor="#000"
android:gravity="left"
android:padding="5dp"/>
<EditText
android:id="@+id/priWeaponRangeEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/NA" android:textSize="14sp"
android:gravity="center"
android:focusable="false"
android:layout_weight="1"
android:cursorVisible="false"
android:longClickable="false"/>
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>
【问题讨论】:
标签: android xml scrollview master-detail android-framelayout