PDA

View Full Version : اسکورل در اکتویتی



myysl97
شنبه 03 مرداد 1394, 08:36 صبح
سلام دوستان
چطوری میشه وقتی طول مطلبمون در اکتویتی زیاد میشه بیایم اسکرول بشه؟
و از طرفی برای گوشی ها مختلف اتوماتیک اول تنظیم بشه بعد که زیاد شد اسکرول بشه؟در asp.net مثلا یه min-height داشتیم .تو این چی؟
ممنون میشم راهنمایی بفرمایید

mimre73
شنبه 03 مرداد 1394, 10:35 صبح
کافیه از ScrollView استفاده کنید به صورت گرافیکی در پوشه composite وجود داره در فایل xml هم خودتون میتونید ایجادش کنید به این صورت که اول تگش رو بنویسید بعد همه ی عناصری رو که داشتین بین این دو تگ کپی کنید تا به صورت scrollView در بیاد.فقط در تگ layout چیزی شبیه به این هست
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" که باید به تگ Scroll انتقال داده بشه

jamal_ch
شنبه 03 مرداد 1394, 13:18 عصر
سلام


<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:background="@drawable/backshowinfo"
android:padding="5dp"
android:layout_weight="0.60" >

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10dip" >

عناصر شما

</LinearLayout>



</ScrollView>

myysl97
شنبه 03 مرداد 1394, 13:52 عصر
ممنون از دوستان
ولی من همین کار رو انجام میدم هیچ یک از گچت های داخل رو نشون نمیده
اینم کدم




<RelativeLayout 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" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
android:background="@android:color/holo_green_dark">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:padding="5dp"
android:layout_weight="0.60"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView">

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10dip" >



<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"
android:layout_alignTop="@+id/scrollView"
android:layout_centerHorizontal="true" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button2"
android:layout_below="@+id/button"
android:layout_centerHorizontal="true" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button3"
android:layout_below="@+id/button2"
android:layout_centerHorizontal="true" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button4"
android:layout_below="@+id/button3"
android:layout_centerHorizontal="true" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button5"
android:layout_below="@+id/button4"
android:layout_centerHorizontal="true" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button6"
android:layout_below="@+id/button5"
android:layout_centerHorizontal="true" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button7"
android:layout_below="@+id/button6"
android:layout_centerHorizontal="true" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button8"
android:layout_below="@+id/button7"
android:layout_centerHorizontal="true" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button9"
android:layout_below="@+id/button8"
android:layout_centerHorizontal="true" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button10"
android:layout_below="@+id/button9"
android:layout_centerHorizontal="true" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button11"
android:layout_alignBottom="@+id/scrollView"
android:layout_centerHorizontal="true" />

</LinearLayout>



</ScrollView>



</RelativeLayout>

jamal_ch
یک شنبه 04 مرداد 1394, 07:45 صبح
ببخشید اون کد رو از تو پروژم کپی کردم


<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dp"




تغییر بده به


<ScrollView
android:layout_width="fill_parent"

android:layout_height="wrap_content"