0

这是我abc.xml在我使用的是相对布局内滚动型父布局,我用fillviewport和滚动条的参数很多次,但它不工作...ScrollView内相对布局不工作...!

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fillViewport="true" 
    android:scrollbars="none"> 

    <RelativeLayout 
    android:id="@+id/SU_user_detail_parent_layout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/custom_background"> 

    <More Components here..../> 

</RelativeLayout> 
</ScrollView> 

这是我如何实现这...

 AlertDialog.Builder alertBuilder = new AlertDialog.Builder(SelectorActivity.this); 

    View view = LayoutInflater.from(SelectorActivity.this).inflate(R.layout.abc, null); 

    alertBuilder.setView(view); 
    AlertDialog d = alertBuilder.create(); 

    d.show(); 
+0

什么不起作用? –

+0

ScrollView无法正常工作... –

+0

您是否尝试过在活动中实现此布局,如果不善于执行调试目的... – Jeevanandhan

回答

1

在scrollview中添加LinearLayout并将其放入Linearlayout中的相对布局。

<ScrollView 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fillViewport="true" 
android:scrollbars="none"> 
<LinearLayout android:layout_width="match_parent" 
android:layout_height="match_parent"> 
<RelativeLayout 
android:id="@+id/SU_user_detail_parent_layout" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:background="@drawable/custom_background"> 

<More Components here..../> 

</RelativeLayout> 
</LinearLayout> 
</ScrollView> 
+0

这不是正确的解决方案@sasikumar其实我必须保持相对布局作为父母的布局..! –