我有一种情况,其中有customView
,SlidingPanelLayout
。哪个已经崩溃并扩大了国家。它也是可以滑动的(当用户滑动视图时,它会加载下一个项目)。折叠状态是默认状态。展开视图时,有一个组件变为可见,折叠时变为不可见。虽然这对于加载的初始视图完全正常,但在为下一个视图滑动时停止工作。我附上了代码。请看看你是否可以帮助我。在此先感谢:)
这是XML文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainUiTouch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical" >
<!-- Offer Title Alt -->
<!-- <FrameLayout -->
<!-- android:layout_width="match_parent" -->
<!-- android:layout_height="wrap_content" -->
<!-- > -->
<LinearLayout
android:id="@+id/frameAltTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/box_two"
android:baselineAligned="false"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:visibility="gone" >
<ImageView
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dp"
android:layout_marginLeft="6dp"
android:layout_marginTop="5dp"
android:contentDescription="@string/hello"
android:src="@drawable/logo" />
<!-- <LinearLayout -->
<!-- android:id="@+id/bottomUiAlt" -->
<!-- android:layout_width="match_parent" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:layout_marginBottom="10dp" -->
<!-- android:background="@drawable/listselector" -->
<!-- android:baselineAligned="false" -->
<!-- android:orientation="horizontal" -->
<!-- android:paddingLeft="10dp" -->
<!-- android:paddingRight="10dp" -->
<!-- android:visibility="invisible" > -->
<!-- <LinearLayout -->
<!-- android:id="@+id/bttomui_child" -->
<!-- android:layout_width="0dp" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:layout_gravity="center_vertical" -->
<!-- android:layout_weight="1" -->
<!-- android:orientation="vertical" -->
<!-- android:tag="bottomView" -->
<!-- android:weightSum="3" > -->
<!-- <TextView -->
<!-- android:id="@+id/txtOfferTitleAlt" -->
<!-- android:layout_width="match_parent" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:layout_marginTop="10dp" -->
<!-- android:layout_weight="2" -->
<!-- android:ellipsize="end" -->
<!-- android:gravity="top|left" -->
<!-- android:maxLines="2" -->
<!-- android:text="@string/hello" -->
<!-- android:textAppearance="?android:attr/textAppearanceMedium" -->
<!-- android:textColor="#0547ab" /> -->
<!-- <TextView -->
<!-- android:id="@+id/textAlt" -->
<!-- android:layout_width="wrap_content" -->
<!-- android:layout_height="0dp" -->
<!-- android:layout_weight="0.5" -->
<!-- android:text="@string/hello" -->
<!-- android:textAppearance="?android:attr/textAppearanceSmall" -->
<!-- android:textColor="#009933" /> -->
<!-- <TextView -->
<!-- android:id="@+id/areaNameAlt" -->
<!-- android:layout_width="wrap_content" -->
<!-- android:layout_height="0dp" -->
<!-- android:layout_weight="0.5" -->
<!-- android:text="@string/hello_world" -->
<!-- android:textAppearance="?android:attr/textAppearanceSmall" -->
<!-- android:textColor="#515151" /> -->
<!-- </LinearLayout> -->
<!-- <TextView -->
<!-- android:layout_width="2dp" -->
<!-- android:layout_height="match_parent" -->
<!-- android:layout_gravity="center_vertical" -->
<!-- android:layout_marginTop="10dp" -->
<!-- android:background="@drawable/right_botton_border" /> -->
<!-- <LinearLayout -->
<!-- android:layout_width="wrap_content" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:layout_gravity="center_vertical" -->
<!-- android:orientation="horizontal" > -->
<!-- <TextView -->
<!-- android:id="@+id/txtDistanceAlt" -->
<!-- android:layout_width="wrap_content" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:drawableTop="@drawable/direction" -->
<!-- android:gravity="bottom" -->
<!-- android:paddingLeft="10dp" -->
<!-- android:text="0.0Km" -->
<!-- android:textAppearance="?android:attr/textAppearanceSmall" -->
<!-- android:textColor="#515151" /> -->
<!-- </LinearLayout> -->
<!-- </LinearLayout> -->
<!-- <ProgressBar -->
<!-- android:id="@+id/progresTitleAlt" -->
<!-- android:layout_width="wrap_content" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:layout_gravity="center" -->
<!-- android:visibility="invisible" /> -->
</LinearLayout>
<!-- Offer Title -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/bottomUi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="@drawable/listselector"
android:baselineAligned="false"
android:orientation="horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:visibility="invisible" >
<LinearLayout
android:id="@+id/bttomui_child"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical"
android:tag="bottomView"
android:weightSum="4" >
<TextView
android:id="@+id/txtOfferTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="2"
android:ellipsize="end"
android:gravity="top|left"
android:maxLines="2"
android:text="@string/hello"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#0547ab" />
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="@string/hello"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#009933" />
<TextView
android:id="@+id/areaName"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="@string/hello_world"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#515151" />
</LinearLayout>
<TextView
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
android:background="@drawable/right_botton_border" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:id="@+id/txtDistance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/direction"
android:gravity="bottom"
android:paddingLeft="10dp"
android:text="0.0Km"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#515151" />
</LinearLayout>
</LinearLayout>
<ProgressBar
android:id="@+id/progresTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="invisible" />
</FrameLayout>
<!-- Offer share section -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ScrollView
android:id="@+id/offerDeatilUi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:visibility="invisible" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="@drawable/top_botton_border"
android:orientation="horizontal"
android:padding="8dp" >
<Button
android:id="@+id/btnCall"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="0.78"
android:background="@null"
android:drawableLeft="@drawable/call"
android:drawablePadding="5dp"
android:gravity="left|center"
android:text="@string/call"
android:textColor="#0547ab"
android:textSize="14sp" />
<TextView
android:layout_width="1dp"
android:layout_height="30dp"
android:layout_marginRight="10dp"
android:background="@drawable/right_botton_border" />
<Button
android:id="@+id/btnSms"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:background="@null"
android:drawableLeft="@drawable/sms"
android:drawablePadding="5dp"
android:gravity="left|center"
android:text="@string/free_sms"
android:textColor="#0547ab"
android:textSize="14sp" />
<TextView
android:layout_width="1dp"
android:layout_height="30dp"
android:layout_marginRight="5dp"
android:background="@drawable/right_botton_border" />
<Button
android:id="@+id/btnShare"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_marginLeft="5dp"
android:layout_weight="0.78"
android:background="@null"
android:drawableLeft="@drawable/share"
android:drawablePadding="5dp"
android:gravity="left|center"
android:text="@string/share"
android:textColor="#0547ab"
android:textSize="14sp" />
</LinearLayout>
<!-- Discription -->
<!-- Address section -->
<LinearLayout
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:orientation="vertical" >
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/imageView_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
<TextView
android:id="@+id/txtPick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:drawableLeft="@drawable/addphoto"
android:drawablePadding="5dp"
android:gravity="center"
android:text="@string/add_photos"
android:textColor="#0547ab"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/txtDisc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:textColor="#515151"
android:textSize="14sp" />
<LinearLayout
android:id="@+id/vr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="@drawable/top_botton_border"
android:orientation="vertical" >
<TextView
android:id="@+id/textMerchName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="10dp"
android:textColor="#0547ab"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.66"
android:gravity="top|left"
android:lineSpacingMultiplier="1.1"
android:textColor="#515151"
android:textSize="14sp" />
<LinearLayout
android:id="@+id/vrt"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="top|left"
android:lineSpacingMultiplier="1.1"
android:text="@string/tel_"
android:textColor="#515151"
android:textStyle="bold" />
<TextView
android:id="@+id/textTelphone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="phone"
android:gravity="top|left"
android:lineSpacingMultiplier="1.1"
android:textColor="#0547ab" />
</LinearLayout>
<TextView
android:id="@+id/textWebSider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.44"
android:autoLink="web"
android:gravity="top|left"
android:lineSpacingMultiplier="1.1"
android:textColor="#0547ab"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/headerReview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/txtViewReview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/all_reviews"
android:textColor="#515151" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="@string/__" />
<TextView
android:id="@+id/submitReview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/submit_review"
android:textColor="#0547ab" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/_" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ProgressBar
android:id="@+id/loadingReview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminate="true"
android:visibility="invisible" />
<TextView
android:id="@+id/reviewUIText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/be_the_first" />
<LinearLayout
android:id="@+id/reviewUi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</FrameLayout>
</LinearLayout>
</ScrollView>
<ListView
android:id="@+id/offertDetailList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:visibility="invisible" >
</ListView>
<ProgressBar
android:id="@+id/offertDeatil"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</FrameLayout>
</LinearLayout>
以下是代码:(我删除了所有样板文件)
PanelSlideListener slideUpListener = new PanelSlideListener() {
@Override
public void onPanelSlide(View panel, float slideOffset) {
View v = panel.findViewById(R.id.frameAltTitle);
v.setVisibility(View.VISIBLE);
}
@Override
public void onPanelExpanded(View panel) {
View v = panel.findViewById(R.id.frameAltTitle);
v.setVisibility(View.VISIBLE);
v.invalidate();
// mOfferTitleView.setVisibility(View.GONE);
if (length > 1) {
area.setText(R.string.close);
}
}
@Override
public void onPanelCollapsed(View panel) {
// frameBanner.setLayoutParams(new LinearLayout.LayoutParams(0, 0));
// frameBanner.invalidate();
View v = panel.findViewById(R.id.frameAltTitle);
v.setVisibility(View.GONE);
v.invalidate();
if (length > 1) {
area.setText(R.string.click_to_see_all_offers);
}
}
@Override
public void onPanelAnchored(View panel) {
// TODO Auto-generated method stub
}
};