سلام. من یه bottomnavigation ساختم که داخلش چند تا آیتم ساختم که هرکدوم از آیتم هارو به یه فرگمنت متصل کردم.
حالا داخل یکی از فرگمنت ها نیاز به اسکرول کردن دارم، که طبق روش معمول اضافه کردن اسکرول ویو به اکتیویتی، به فرگمنت اضافه کردم. ولی وقتی برنامه رو ران می کنم عمل اسکرول کردن انجام نمیشه.
آیا نحوه اضافه کردن اسکرول ویو به اکتیویتی با فرگمنت فرق داره؟
فقط یه چیزو یادم رفت اینه که من اسرکرول ویو رو داخل فایل جاوای فرگمنت ست نکردم هنوز
**************اینم سورس کد فرگمنت**********************
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".Fragments.categoryFragment">
<ScrollView
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/btn_cat_car"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="وسایل نقلیه" />
<Button
android:id="@+id/btn_cat_amlac"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="املاک" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/btn_cat_farsh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="لوازم خانگی" />
<Button
android:id="@+id/btn_cat_electronic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="لوازم الکترونیکی" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/btn_cat_shakhsy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="وسایل شخصی" />
<Button
android:id="@+id/btn_cat_khadamat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="خدمات" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/butto2n"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="Button" />
<Button
android:id="@+id/btn_cat_estekhdam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="استخدام و کاریابی" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/but7ton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="Button" />
<Button
android:id="@+id/bu7tton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="Button" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/bu9t7ton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="Button" />
<Button
android:id="@+id/bu7t8ton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="Button" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/b1ut7ton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="Button" />
<Button
android:id="@+id/bu37tton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/panel"
android:text="Button" />
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>
*******************اینم سورس کد اکتیویتی که داخلش فرگمت رو گذاشتم******************
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="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:orientation="vertical"
tools:context=".ShowAllAdvs"
android:layoutDirection="ltr"
>
<FrameLayout
android:id="@+id/my_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/bottom_navigation" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_show_all"
android:minHeight="?attr/actionBarSize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#F8F7F7"
android:layoutDirection="ltr">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:orientation="horizontal"
>
<LinearLayout
android:layout_width="440dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal"
android:paddingLeft="5dp">
<ImageView
android:id="@+id/img_btn_add_adv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="5"
android:padding="2dp"
app:srcCompat="@drawable/btn_add" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:gravity="center|left"
android:text="ارسال آگهی جدید"
android:textColor="#1D1C1C" />
</LinearLayout>
<LinearLayout
android:layout_width="470dp"
android:layout_height="match_parent"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:gravity="center|right"
android:layoutDirection="ltr"
android:orientation="horizontal"
android:paddingRight="3dp">
<SearchView
android:id="@+id/view_search"
android:layout_width="170dp"
android:layout_height="match_parent"
android:layoutDirection="ltr" />
</LinearLayout>
<LinearLayout
android:layout_width="360dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center|right"
android:layoutDirection="ltr"
android:orientation="horizontal"
android:paddingRight="10dp">
<ImageView
android:layout_width="35dp"
android:layout_height="45dp"
app:srcCompat="@drawable/logo" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
<ListView
android:divider="@null"
android:dividerHeight="0dp"
android:id="@+id/List_all_Advs"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="55dp"
android:layoutDirection="ltr"
android:layout_marginBottom="70dp"
/>
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="-3dp"
android:layoutDirection="ltr"
app:menu="@menu/bottom_navigation" />
</RelativeLayout>
پاسخ ها