ساختن برنامه اندرویدی در گوشی

saalek110

Well-Known Member
از صفحه :


این یک آموزش ، ساخت اولین برنامه است. با اندروید استودیو است ولی ساختار و کدها همونه.

در یک جایی میگه:

Screenshot_۲۰۲۳-۰۹-۱۲_۱۹۱۷۰۴.jpg

در عکس بالا به جای اینکه مستقیم عبارت رشته ای تعیین کند ، می خواهد یک رشته در فایل رشته ها داشته باشد.
یعنی همون strings.xml که در پوشه values قرار دارد.
ممکن است این جوری مزیتی داشته باشد.

فقط در این پست خواستم بدانید احتمالا هر دو روش هم میشه.


در ادامه یک سری صفات تکست ویوو را می بینیم، از همان لینک:
Java:
<TextView
   android:id="@+id/textview_first"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:fontFamily="sans-serif-condensed"
   android:text="@string/hello_first_fragment"
   android:textColor="@android:color/darker_gray"
   android:textSize="30sp"
   android:textStyle="bold"
برای این ، این صفات را اینجا پست می کنم ، که در برنانه های خودمون استفاده کنیم.
 

saalek110

Well-Known Member
از همان لینک:

افزودن رنگ به colors.xml

Screenshot_۲۰۲۳-۰۹-۱۲_۱۹۲۷۳۵.jpg

محتویات فایل مذکور:
Java:
<resources>
    <color name="colorPrimary">#6200EE</color>
    <color name="colorPrimaryDark">#3700B3</color>
    <color name="colorAccent">#03DAC5</color>
</resources>

همان طور که می بینید هر رنگ یک اسم داره و بعد رنگش مشخص میشه.
اگر با این کد رنگها آشنا نیستید ، در یک آموزش html قسمت رنگ را ببینید.


همان طور که در عکس فوق می بینید ، رنگها کنار رشته ها ، در پوشه values است و استایل ها هم کنارشون است، سه تا میشه کلا.
 

saalek110

Well-Known Member
ادامه پست قبل:

Screenshot_۲۰۲۳-۰۹-۱۲_۱۹۳۳۱۴.jpg

در عکط فوق می بینید وقتی حرف c را زدیم ، لیست رنگهای داخل فایل رنگها پیشنهاد داده میشه. البته این اندروید استودیو است ولی شاید نرم افزار ما هم داشته باشه، codeassist.
 

saalek110

Well-Known Member
Java:
<TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView3"
        android:layout_below="@+id/textView3"
        android:layout_marginTop="14dp"
        android:text="Small Text"
        android:textAppearance="?android:attr/textAppearanceSmall" />
 
    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView4"
        android:layout_below="@+id/textView4"
        android:layout_marginTop="16dp"
        android:text="Button" />
 
    <ToggleButton
        android:id="@+id/toggleButton1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/button2"
        android:layout_alignBottom="@+id/button2"
        android:layout_alignParentRight="true"
        android:text="ToggleButton" />
 
    <Button
        android:id="@+id/button2"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/button1"
        android:layout_centerHorizontal="true"
        android:text="Small Button" />
 
    <CheckBox
        android:id="@+id/checkBox1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/toggleButton1"
        android:layout_below="@+id/toggleButton1"
        android:layout_marginTop="93dp"
        android:text="CheckBox" />
 
    <CheckedTextView
        android:id="@+id/checkedTextView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/checkBox1"
        android:layout_alignBottom="@+id/checkBox1"
        android:layout_alignLeft="@+id/button1"
        android:text="CheckedTextView" />
 
    <RadioButton
        android:id="@+id/radioButton1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/checkedTextView1"
        android:layout_below="@+id/checkBox1"
        android:layout_marginTop="34dp"
        android:text="RadioButton" />
 
    <RadioButton
        android:id="@+id/radioButton2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/radioButton1"
        android:layout_below="@+id/radioButton1"
        android:text="RadioButton" />


منظور کد دیگر ابزارهاست.


در پایین این صفحه یک سری پروژه هست که شاید بعدا به کارمون بیاید.
 

جدیدترین ارسال ها

بالا