سلام، در استفاده از scrollview دچار مشکل هستم، کدهای قسمت activity به صورت زیر است و نمیدونم چرا قسمت بالای صفحه در حالت Landscape توسط اسکرول پشتیبانی نمیشه.
<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:context="google.com.gamexo.MainActivity" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:layout_margin="10sp" android:layout_gravity="center"> <Button android:layout_width="220sp" android:layout_height="wrap_content" android:text="دکمه یک" android:textSize="40sp" android:textColor="#fff" android:padding="15sp" android:textStyle="bold" android:id="@+id/btn_2person" android:layout_gravity="center" android:layout_marginTop="10sp"/> <Button android:layout_width="220sp" android:layout_height="wrap_content" android:text="دکمه دوم" android:textSize="40sp" android:textColor="#fff" android:layout_marginTop="20sp" android:textStyle="bold" android:padding="15sp" android:id="@+id/btn_2computer" android:layout_gravity="center"/> <Button android:layout_width="220sp" android:layout_height="wrap_content" android:text="دکمه سوم" android:textSize="40sp" android:textColor="#fff" android:layout_marginTop="20sp" android:textStyle="bold" android:padding="15sp" android:id="@+id/btn_help" android:layout_gravity="center"/> <Button android:layout_width="220sp" android:layout_height="wrap_content" android:text="دکمه چهارم" android:textSize="40sp" android:textColor="#fff" android:layout_marginTop="20sp" android:textStyle="bold" android:padding="15sp" android:id="@+id/btn_aboutme" android:layout_gravity="center"/> </LinearLayout> </ScrollView>
ضمنا در این جا کد صفحه دیگری رو قرار میدم که باز هم مشکل استفاده از scrollview است. در حالت Portrait فضای سفیدی در زیر صفحه اسکرول میشه و نمیدونم چرا اینطور شده و چطور رفعش کنم؟ به ضمیمه کد، عکس و دو فایل XML اضافه میشه که در قسمت drawable باید قرار بگیرند.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout 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" tools:context="google.com.gheshmica.MainActivity"> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:weightSum="100" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="50" android:background="@drawable/th"></LinearLayout> <LinearLayout android:gravity="center_horizontal" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="50" android:orientation="vertical" android:padding="10dp"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="#065D89" android:layout_margin="10dp" android:gravity="center" android:text="برای ورود شماره تلفن و کد ملی خود را وارد کنید" android:textSize="14sp" android:textStyle="bold"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="15dp" android:layout_marginTop="10dp" android:gravity="center" android:orientation="horizontal" android:weightSum="100"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="70" android:background="@drawable/lin1" android:paddingLeft="6dp" android:paddingRight="6dp" android:paddingBottom="2dp" android:paddingTop="2dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="50dp" android:paddingBottom="2dp" android:paddingRight="5dp" android:paddingLeft="5dp" android:background="@drawable/lin2"> <EditText android:layout_width="match_parent" android:layout_height="match_parent" android:inputType="phone" android:textColor="#000" android:gravity="center" android:hint="شماره موبایل" android:textSize="18sp" /> </LinearLayout> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10dp" android:gravity="center" android:orientation="horizontal" android:weightSum="100"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="70" android:background="@drawable/lin1" android:paddingLeft="6dp" android:paddingRight="6dp" android:layout_marginBottom="2dp" android:paddingTop="2dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="50dp" android:background="@drawable/lin2" android:padding="4dp"> <EditText android:layout_width="match_parent" android:layout_height="match_parent" android:inputType="phone" android:gravity="center" android:hint="کد ملی" android:textSize="18sp" android:textColor="#000"/> </LinearLayout> </LinearLayout> </LinearLayout> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="20dp" android:textColor="#000" android:background="@drawable/lin1" android:layout_marginTop="30dp" android:text="تایید"/> </LinearLayout> </LinearLayout> </ScrollView> </LinearLayout>
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)