亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何修復我的線性布局以在內容超出視圖時向下滾動

如何修復我的線性布局以在內容超出視圖時向下滾動

30秒到達戰場 2022-09-22 16:26:00
我正在動態地向適配器添加視圖,當視圖超過屏幕邊界時,我無法看到完整視圖。我試過了,沒有任何運氣。android:isScrollContainer="true"android:scrollbars="vertical"public void onAddField(View v) {         final LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);         final View rowView = inflater.inflate(R.layout.field, null);         spin = rowView.findViewById(R.id.type_spinner2);         weightLayout = rowView.findViewById(R.id.myLayout);         getdata();         spin.setAdapter(new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_spinner_dropdown_item, arrayList2));         parentLinearLayout.addView(rowView, parentLinearLayout.getChildCount() - 1); <LinearLayout         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_weight="1"         android:background="#E5E5E5"         android:orientation="vertical"         android:scrollbars="vertical"         android:isScrollContainer="true">
查看完整描述

1 回答

?
牛魔王的故事

TA貢獻1830條經驗 獲得超3個贊

嘗試使用這個:

 <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/card"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">


    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/textView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="50dp"
                android:text="TextView" />
        </LinearLayout>

    </ScrollView>

</LinearLayout>

這樣,您的滾動視圖將隨您的線輪布局一起擴展。


查看完整回答
反對 回復 2022-09-22
  • 1 回答
  • 0 關注
  • 109 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號