こんにちは私はAndroid開発で新しく、ListView
がScrollview
の内部にあってはならないという事実について話し、線形または相対レイアウトで折り返す必要があることを話しました。ListView collapse in CustomScrollView
しかし、私は、このレイアウト
<com.itmind.spac.spacapp.custom_extends.CustomScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollViewreceipt"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/include1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
layout="@layout/toolbar" />
<Spinner
android:id="@+id/customers_spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:theme="@android:style/Theme.Holo.Light.DarkActionBar"
/>
<Spinner
android:id="@+id/venues_spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:theme="@android:style/Theme.Holo.Light.DarkActionBar"
/>
<Spinner
android:id="@+id/workgroup_spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:theme="@android:style/Theme.Holo.Light.DarkActionBar"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="150dp">
<ListView
android:id="@+id/activityList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="15dp"
android:minHeight="150dp"
/>
</LinearLayout >
<android.gesture.GestureOverlayView
android:id="@+id/signaturePad"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_weight="5"
android:background="#d3d3d3"
android:eventsInterceptionEnabled="true"
android:fadeEnabled="false"
android:gestureColor="#333"
android:gestureStrokeLengthThreshold="0.1"
android:gestureStrokeType="multiple"
android:fadeOffset="5000"
android:orientation="vertical" >
</android.gesture.GestureOverlayView>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="testImage"
android:text="testami"/>
</LinearLayout>
を持っており、これは私が
に触れたときにスクロールを有効に設定することができbeacause私はcustomclassスクロールビューを必要とするpublic class CustomScrollView extends ScrollView {
private boolean enableScrolling = true;
public boolean isEnableScrolling() {
return enableScrolling;
}
public void setEnableScrolling(boolean enableScrolling) {
this.enableScrolling = enableScrolling;
}
public CustomScrollView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public CustomScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomScrollView(Context context) {
super(context);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (isEnableScrolling()) {
return super.onInterceptTouchEvent(ev);
} else {
return false;
}
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (isEnableScrolling()) {
return super.onTouchEvent(ev);
} else {
return false;
}
}
}
私custoScrollViewです
私の活動では、GestureOverlayView.OnGestureListenerを実装しています私は持っています:
@Override
public void onGestureStarted(GestureOverlayView overlay, MotionEvent event) {
myScrollView.setEnableScrolling(false);
}
@Override
public void onGestureEnded(GestureOverlayView overlay, MotionEvent event) {
myScrollView.setEnableScrolling(true);
}
多くの要素と私はすべての要素を表示するためにscrollViewする必要があります。 私のscrollViewの中には、私はデータベースから取得するデータを取り込むlistViewがあります。
私の問題は、私のリストビューが崩壊し、1行を表示し、1行で表示してスクロールすることです。
私はmin-height
を試しましたが、うまくいかず、Listview
にレイアウトの高さを置くと、このリストはスクロールできません。
どうすればいいですか? 私はリストを表示します。長いページで表示するので、scrollviewを使用する必要がありますか、またはソリューションはありますか?
なぜカスタムスクロールビュークラスを使用していますか?コードを貼り付けます。 –
こんにちは、私はのためにcustomScrollviewを使用します。 私のクラスを編集して貼り付けます。 –
LorenzoBerti