我正在搜索整个网络,但我没有看到有人问这个:
您好scroolview
,我需要view
在查看的屏幕中居中,我的意思是:
我设置了一个gravity:center
attribute
,但当scrollview
变得更长时view
不再可见,因为它位于scrollview
的中心,而不是view
电话屏幕。如何将<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.percent.PercentRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#FFEFD5"
android:id="@+id/dialog_layout"
android:clickable="false"
android:visibility="gone">
<EditText
app:layout_widthPercent="75%"
app:layout_heightPercent="12%"
android:id="@+id/testo"
app:layout_marginLeftPercent="9%"
app:layout_marginRightPercent="9%"
android:background="#F5F5F5"
app:layout_marginTopPercent="5%"
android:hint="Please, insert the text for the new button."
android:gravity="center"
android:maxLength="19"/>
<Button
app:layout_widthPercent="75%"
app:layout_heightPercent="12%"
android:layout_below="@id/testo"
app:layout_marginLeftPercent="9%"
app:layout_marginRightPercent="9%"
app:layout_marginBottomPercent="3%"
android:text="Accept"
android:id="@+id/accept"/>
</android.support.percent.PercentRelativeLayout>
</FrameLayout>
</ScrollView>
置于您所看到的屏幕大小的中心位置?
friend std::ostream& operator<< <>(std ::ostream& out, Array1D<T>& a);
答案 0 :(得分:-1)
试试这个
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
</ScrollView>
<android.support.percent.PercentRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#FFEFD5"
android:id="@+id/dialog_layout"
android:clickable="false"
android:layout_centerInParent="true"
android:visibility="gone">
<EditText
app:layout_widthPercent="75%"
app:layout_heightPercent="12%"
android:id="@+id/testo"
app:layout_marginLeftPercent="9%"
app:layout_marginRightPercent="9%"
android:background="#F5F5F5"
app:layout_marginTopPercent="5%"
android:hint="Please, insert the text for the new button."
android:gravity="center"
android:maxLength="19"/>
<Button
app:layout_widthPercent="75%"
app:layout_heightPercent="12%"
android:layout_below="@id/testo"
app:layout_marginLeftPercent="9%"
app:layout_marginRightPercent="9%"
app:layout_marginBottomPercent="3%"
android:text="Accept"
android:id="@+id/accept"/>
</android.support.percent.PercentRelativeLayout>
</RelativeLayout>