Stack Overflow em Português Asked by Bruno Loducca on December 20, 2021
Olá, estou tentando usar um ListView dentro de um ScrollView. O objetivo é funcionar semelhante a outros apps que fazem isso, como o instagram e o jovem nerd. Abaixo do meu comentário vai estar o código em xml e debaixo dele em java.Obrigado
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#212121"
android:orientation="vertical">
<com.daimajia.slider.library.SliderLayout
android:id="@+id/slImageResource"
android:layout_width="match_parent"
android:layout_height="205dp"
android:layout_marginTop="0dp"
android:scaleType="fitXY" />
<com.daimajia.slider.library.Indicators.PagerIndicator
android:id="@+id/custom_indicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-4dp"
android:gravity="center"
custom:selected_color="#FFFFFF"
custom:selected_height="6dp"
custom:selected_padding_left="6dp"
custom:selected_padding_right="6dp"
custom:selected_width="6dp"
custom:shape="oval"
custom:unselected_color="#55333333"
custom:unselected_height="6dp"
custom:unselected_padding_left="2dp"
custom:unselected_padding_right="2dp"
custom:unselected_width="6dp" />
<ListView
android:id="@+id/list_test"
android:layout_width="match_parent"
android:layout_height="match_parent"></ListView>
</LinearLayout>
slImages = (SliderLayout)rootView.findViewById(R.id.slImageResource);
FSocietySlideView slideView = new FSocietySlideView(getContext());
slideView.image(R.mipmap.ic_launcher);
slideView.setOnSliderClickListener(HomeFragment.this);
slideView.description("None");
slImages.addSlider(slideView);
final ArrayList<FSociety> news = new ArrayList<>();
news.add(new FSociety(getResources(), "None", "None", R.mipmap.ic_launcher));
news.add(new FSociety(getResources(), "None", "None", R.mipmap.ic_launcher));
news.add(new FSociety(getResources(), "None", "None", R.mipmap.ic_launcher));
news.add(new FSociety(getResources(), "None", "None", R.mipmap.ic_launcher));
news.add(new FSociety(getResources(), "None", "None", R.mipmap.ic_launcher));
news.add(new FSociety(getResources(), "None", "None", R.mipmap.ic_launcher));
FSocietyAdapter adapter = new FSocietyAdapter(getActivity(),news);
ListView listView = (ListView)rootView.findViewById(R.id.list_test);
listView.setAdapter(adapter);
return rootView;
}
Coloque o ListView dentro de um LinearLayout com altura fixa. Assim você poderá colocar o Scroll em toda a Activity e ainda com o Scroll do próprio ListView.
Answered by VictorGrechi on December 20, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP