4EBRAHIM4
جمعه 30 بهمن 1394, 11:02 صبح
سلام به همه اندروید دوستان
من به تازگی شروع یه یادگیری اندوید کردم و الانم دارم با fragment ها دست و پنچه نرم می کنم
یه برنامه کوچیک نوشتم تا با fragment آشنا بشم ولی ارور داد بعد از کمی حلاجی فهمیدم که زمانی که توی activity_main.xml از<fragment> استفاده میکنم برنامه ارور میده وحتی اجرا هم نمیشه
اگه کسی میدونه که مشکل از کجاس لطفا بگه
ارادتمند
<?xml version="1.0" encoding="utf-8"?>
<LinearLayoutxmlns: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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.ebrahim.testfragment.MainActivity"
tools:showIn="@layout/activity_main"
android:orientation="vertical"
android:weightSum="1">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="B1"
android:id="@+id/button1" />
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fragment" />
</LinearLayout>
من به تازگی شروع یه یادگیری اندوید کردم و الانم دارم با fragment ها دست و پنچه نرم می کنم
یه برنامه کوچیک نوشتم تا با fragment آشنا بشم ولی ارور داد بعد از کمی حلاجی فهمیدم که زمانی که توی activity_main.xml از<fragment> استفاده میکنم برنامه ارور میده وحتی اجرا هم نمیشه
اگه کسی میدونه که مشکل از کجاس لطفا بگه
ارادتمند
<?xml version="1.0" encoding="utf-8"?>
<LinearLayoutxmlns: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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.ebrahim.testfragment.MainActivity"
tools:showIn="@layout/activity_main"
android:orientation="vertical"
android:weightSum="1">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="B1"
android:id="@+id/button1" />
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fragment" />
</LinearLayout>