在扩大Android应用下片对话框

问题描述 投票:0回答:1

我上时被按下的按钮的屏幕被调用的底部片材显示数据。然而,在片材比可以在屏幕上显示在更多的文本,并且作为结果,文本被裁剪。我怎样才能解决这个问题,使对话可以滚动到屏幕的边缘?

我的底部布局的XML文件如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:text=""
    android:id="@+id/splo"
    />

</LinearLayout>

而我用下面的代码召唤它:

 BottomSheetDialog dialog = new BottomSheetDialog(this);

    View view = getLayoutInflater().inflate(R.layout.fragment_bottom_layout, null);

    dialog.setContentView( view );

    TextView tv = (TextView) view.findViewById( R.id.splo);
    tv.setText( sp );

    dialog.show();
android bottom-sheet
1个回答
1
投票

你可以把你的TextView一个ScrollView内。您的代码应该是这样的:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:text=""
    android:id="@+id/splo"
    />
</ScrollView>

</LinearLayout>
© www.soinside.com 2019 - 2024. All rights reserved.