আমি খুব সাধারণ সমস্যার মুখোমুখি হয়েছি: আমি একটি ক্রিয়াকলাপ প্রকাশ করেছি এবং এখন দেখা যাচ্ছে এটি এর মধ্যে কয়েকটি আইটেম প্রদর্শন করা উচিত ScrollView। এটি করার স্বাভাবিক উপায় হ'ল বিদ্যমানটি ব্যবহার করা ListAdapter, এটির সাথে সংযোগ স্থাপন করা ListViewএবং আমার কাছে আইটেমের তালিকা থাকত O
কিন্তু আপনি একটি নেস্টেড স্থাপন উচিত নয় ListViewএকটি ScrollViewএমনকি Android লিন্ট এটি সম্পর্কে অভিযোগ - এটা স্ক্রলিং আপ স্ক্রু হিসাবে।
সুতরাং এখানে আমার প্রশ্ন:
আমি কীভাবে ListAdapterএকটি LinearLayoutবা অনুরূপ কিছুতে সংযুক্ত করব ?
আমি জানি এই সমাধানটি অনেকগুলি আইটেমের জন্য স্কেল করবে না তবে আমার তালিকাগুলি খুব ছোট (<10 আইটেম) তাই ভিউগুলি পুনরায় ব্যবহারের প্রয়োজন হয় না। পারফরম্যান্স অনুসারে আমি সমস্ত দর্শন সরাসরি মধ্যে রেখেই বেঁচে থাকতে পারি LinearLayout।
আমি যে সমাধানটি নিয়ে এসেছি তা হ'ল আমার বিদ্যমান ক্রিয়াকলাপের বিন্যাসটি এর শিরোনামদ্বার অংশে রাখুন ListView। তবে এটি এই প্রক্রিয়াটিকে অপব্যবহারের মতো অনুভব করে তাই আমি একটি পরিষ্কার সমাধানের সন্ধান করি।
ধারনা?
আপডেট: সঠিক দিকটি অনুপ্রাণিত করার জন্য আমি আমার সমস্যাটি দেখানোর জন্য একটি নমুনা বিন্যাস যুক্ত করেছি:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/news_detail_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:visibility="visible">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFF"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/news_detail_layout_side_padding"
android:paddingRight="@dimen/news_detail_layout_side_padding"
android:paddingTop="@dimen/news_detail_layout_vertical_padding"
android:paddingBottom="@dimen/news_detail_layout_vertical_padding"
>
<TextView
android:id="@+id/news_detail_date"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center_horizontal"
android:text="LALALA"
android:textSize="@dimen/news_detail_date_height"
android:textColor="@color/font_black"
/>
<Gallery
android:id="@+id/news_detail_image"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:paddingTop="5dip"
android:paddingBottom="5dip"
/>
<TextView
android:id="@+id/news_detail_headline"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center_horizontal"
android:text="Some awesome headline"
android:textSize="@dimen/news_detail_headline_height"
android:textColor="@color/font_black"
android:paddingTop="@dimen/news_detail_headline_paddingTop"
android:paddingBottom="@dimen/news_detail_headline_paddingBottom"
/>
<TextView
android:id="@+id/news_detail_content"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="Here comes a lot of text so the scrollview is really needed."
android:textSize="@dimen/news_detail_content_height"
android:textColor="@color/font_black"
/>
<!---
HERE I NEED THE LIST OF ITEMS PROVIDED BY THE EXISTING ADAPTER.
They should be positioned at the end of the content, so making the scrollview smaller is not an option.
---->
</LinearLayout>
</ScrollView>
</LinearLayout>
আপডেট 2 আমি বুঝতে সহজ করার জন্য শিরোনামটি পরিবর্তন করেছি (একটি ডাউনওয়েট পেয়েছি, দোহ!)।