我有一个布局,其中HorizontalScrollView包含一个LinearLayout菜单,其中的内容用数据库的内容充气.这样可以正常工作,但是当没有足够的元素来进行HSV滚动时,这不会填满理想应该居中的屏幕宽度.即目前:
| Element 1 Element 2 | <- edge of screen
Run Code Online (Sandbox Code Playgroud)
代替:
| Element 1 Element 2 | <- edge of screen
Run Code Online (Sandbox Code Playgroud)
同时仍然能够:
| Element 1 Element 2 Element 3 Element 4 Elem| <- edge of screen now scrolling
Run Code Online (Sandbox Code Playgroud)
布局XML是:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLinearLayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="25dp" >
</TextView>
<ScrollView
android:id="@+id/scroll1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<LinearLayout
android:id="@+id/contentLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="fill_parent"
android:layout_height="30dp"> …Run Code Online (Sandbox Code Playgroud)