Scrollview contains ViewPager and LinearLayouts with TextView inside the LinearLayout,But TextView ClickListener is not working(Not Clickable)?

☆樱花仙子☆ 提交于 2020-01-07 03:52:35

问题


        <nl.vogelbescherming.wadvogels.util.HackyScrollView
        android:id="@+id/scroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:scrollbarStyle="outsideOverlay" >

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

            <nl.vogelbescherming.wadvogels.util.HackyViewPager
                android:id="@+id/profiles"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@android:color/white" />

            <LinearLayout
                android:id="@+id/info"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="30dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:orientation="vertical" >

                <TableLayout
                    android:id="@+id/infoBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TableRow
                        android:id="@+id/tableRow1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" >

                        <TextView
                            android:id="@+id/voorkomen_title"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:text="MAIN HEADER"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="@color/text_color"
                            android:textSize="@dimen/text_size" />

                        <TextView
                            android:id="@+id/voorkomen_content"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="10dp"
                            android:layout_weight="3"
                            android:text="MAIN HEADER"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="@color/text_color"
                            android:textSize="@dimen/text_size" />
                    </TableRow>

                    <TableRow
                        android:id="@+id/tableRow2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" >

                        <TextView
                            android:id="@+id/trefkans_title"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:text="MAIN HEADER"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="@color/text_color"
                            android:textSize="@dimen/text_size" />

                        <TextView
                            android:id="@+id/trefkans_content"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="10dp"
                            android:layout_weight="3"
                            android:text="MAIN HEADER"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="@color/text_color"
                            android:textSize="@dimen/text_size" />
                    </TableRow>

                    <TableRow
                        android:id="@+id/tableRow3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" >

                        <TextView
                            android:id="@+id/grootte_title"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:text="MAIN HEADER"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="@color/text_color"
                            android:textSize="@dimen/text_size" />

                        <TextView
                            android:id="@+id/grootte_content"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="10dp"
                            android:layout_weight="3"
                            android:text="MAIN HEADER"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="@color/text_color"
                            android:textSize="@dimen/text_size" />
                    </TableRow>
                </TableLayout>

                <TextView
                    android:id="@+id/description"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingBottom="15dp"
                    android:paddingTop="10dp"
                    android:text="Het is een adembenemend schouwspel; een jagende boomvalk 
die met hoge snelheid en een luide &apos;tsjak&apos; een libel uit de lucht 
grijpt. Boomvalken zijn gespecialiseerd in het vangen van 
vliegende prooidieren Lees meer..."
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textSize="@dimen/text_size" />

                <LinearLayout
                    android:id="@+id/in_shadow"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:focusableInTouchMode="true"
                    android:orientation="vertical" >

                    <TextView
                        android:id="@+id/meer_informative_content"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Snavel"
                        android:textColor="@color/text_color"
                        android:textSize="@dimen/>
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>
    </nl.vogelbescherming.wadvogels.util.HackyScrollView>

Main Activity Code:

    TextView meer_con = (TextView) findViewById(R.id.meer_informative_content);
    meer_con.setText("Hi i am chawal Text,,,Try to CLick me:@");
    meer_con.setClickable(true);
    meer_con.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Log.d("MEER_TAG","meer_informative_content_text_Displayed");
            System.out.println("meer_informative_content_text_Displayed");
        }
    });

来源:https://stackoverflow.com/questions/33011774/scrollview-contains-viewpager-and-linearlayouts-with-textview-inside-the-linearl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!