首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android磨损:CardScrollView不能滚动吗?

Android磨损:CardScrollView不能滚动吗?
EN

Stack Overflow用户
提问于 2014-08-07 04:21:59
回答 1查看 2.2K关注 0票数 3

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

CardScrollViewActivity.java

代码语言:javascript
复制
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

代码语言:javascript
复制
<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>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-30 08:04:34

CardScrollView似乎不像ScrollView那样工作。

您可以将CardFrame与ScrollView包装起来。

代码语言:javascript
复制
<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>
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25174105

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档