gpt4 book ai didi

安卓磨损 :CardScrollView cannot scroll?

转载 作者:太空宇宙 更新时间:2023-11-03 12:53:41 24 4
gpt4 key购买 nike

我在我的项目中使用了 CardScrollView 和 CardFrame,但是 CardScrollView 不能滚动,这是我的代码,有什么建议吗?

CardScrollViewActivity.java

public class CardScrollViewActivity extends Activity {

private CardFrame cardFrame;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.card_scroll_view);
cardFrame=(CardFrame)findViewById(R.id.card_frame);
cardFrame.setExpansionDirection(CardFrame.EXPAND_UP);
cardFrame.setExpansionEnabled(true);
cardFrame.setExpansionFactor(CardFrame.NO_EXPANSION);
}
}

card_scroll_view.xml

<android.support.wearable.view.CardScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.wearable.view.CardFrame
android:id="@+id/card_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="TestTextView\nTestTextView\nTestTextView\nTestTextView\nTestTextView\nTestTextView\nTestTextView\nTestTextView"/>
</android.support.wearable.view.CardFrame>
</android.support.wearable.view.CardScrollView>

最佳答案

CardScrollView 似乎不像 ScrollView 那样工作。

你可以用 ScrollView 包裹 CardFrame。

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

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

<android.support.wearable.view.CardFrame
android:id="@+id/cardFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

</android.support.wearable.view.CardFrame>

</FrameLayout>

</ScrollView>

关于安卓磨损 :CardScrollView cannot scroll?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25174105/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com