نمایش نتایج 1 تا 9 از 9

نام تاپیک: جچوری Tilte Bar را راست چین کنم؟

  1. #1

    Question جچوری Tilte Bar را راست چین کنم؟

    با سلام دوستان. من دارم یه برنامه فارسی اندروید می نویسیم اما ظاهر Title Bar یا همون Action Bar اونو زشت کرده. لطفا راهنمایی کنید چجوری اونو راست چین کنم ؟

  2. #2
    کاربر دائمی آواتار saeed_g21
    تاریخ عضویت
    مرداد 1388
    محل زندگی
    تبریز
    پست
    1,078

    نقل قول: جچوری Tilte Bar را راست چین کنم؟

    بایستی سفارشی کنیش
    خوب اگه نیازش نداری حذفش کن با
    getActionBar().hide();


    اگه نیازش داری بگو کد دیگه بگم

  3. #3

    نقل قول: جچوری Tilte Bar را راست چین کنم؟

    نقل قول نوشته شده توسط saeed_g21 مشاهده تاپیک
    بایستی سفارشی کنیش
    خوب اگه نیازش نداری حذفش کن با
    getActionBar().hide();


    اگه نیازش داری بگو کد دیگه بگم
    آره نیازش دارم. واسه Sliding Menu.
    به فکرمم رسید سفارشی درست کنم, اما Sliding menu را چیکارش کنم؟

  4. #4
    کاربر دائمی آواتار saeed_g21
    تاریخ عضویت
    مرداد 1388
    محل زندگی
    تبریز
    پست
    1,078

    نقل قول: جچوری Tilte Bar را راست چین کنم؟

    ببین این کد کمکت میکنه

    	    	  private void ActionBar(){	    		   	 ActionBar mActionBar = getActionBar();
    mActionBar.setDisplayShowHomeEnabled(false);
    mActionBar.setDisplayShowTitleEnabled(false);
    LayoutInflater mInflater = LayoutInflater.from(this);
    View mCustomView = mInflater.inflate(R.layout.action_kala, null);
    TextView mTitleTextView = (TextView) mCustomView.findViewById(R.id.title_text);
    mTitleTextView.setText(getString(R.string.app_name ));
    ImageButton imageButton = (ImageButton) mCustomView.findViewById(R.id.imageButton);
    mActionBar.setCustomView(mCustomView);
    mActionBar.setDisplayShowCustomEnabled(true);
    imageButton.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View arg0) {
    Intent intent = new Intent(catalog.this,filterprudoct.class);
    startActivity(intent);
    }
    });
    }



    اینم کد لایوت

    <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="50dp" >

    <ImageButton
    android:id="@+id/imageButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:layout_marginRight="8dp"
    android:background="@null"
    android:src="@android:drawable/ic_menu_gallery" />



    <TextView
    android:id="@+id/title_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="10dp"
    android:textAllCaps="true"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="#fff"
    android:textStyle="bold" />

    </RelativeLayout>



    استفاده :

    فراخوانی کد زیر در اکتیویتی های مورد نظر
    ActionBar();

  5. #5

    نقل قول: جچوری Tilte Bar را راست چین کنم؟

    نقل قول نوشته شده توسط saeed_g21 مشاهده تاپیک
    ببین این کد کمکت میکنه

                  private void ActionBar(){                        ActionBar mActionBar = getActionBar();
    mActionBar.setDisplayShowHomeEnabled(false);
    mActionBar.setDisplayShowTitleEnabled(false);
    LayoutInflater mInflater = LayoutInflater.from(this);
    View mCustomView = mInflater.inflate(R.layout.action_kala, null);
    TextView mTitleTextView = (TextView) mCustomView.findViewById(R.id.title_text);
    mTitleTextView.setText(getString(R.string.app_name ));
    ImageButton imageButton = (ImageButton) mCustomView.findViewById(R.id.imageButton);
    mActionBar.setCustomView(mCustomView);
    mActionBar.setDisplayShowCustomEnabled(true);
    imageButton.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View arg0) {
    Intent intent = new Intent(catalog.this,filterprudoct.class);
    startActivity(intent);
    }
    });
    }



    اینم کد لایوت

    <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="50dp" >

    <ImageButton
    android:id="@+id/imageButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:layout_marginRight="8dp"
    android:background="@null"
    android:src="@android:drawable/ic_menu_gallery" />



    <TextView
    android:id="@+id/title_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="10dp"
    android:textAllCaps="true"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="#fff"
    android:textStyle="bold" />

    </RelativeLayout>



    استفاده :

    فراخوانی کد زیر در اکتیویتی های مورد نظر
    ActionBar();

    میشه یجور دیگه بگید از اول باید چیکار کنم من گیج شدم

  6. #6
    کاربر دائمی آواتار saeed_g21
    تاریخ عضویت
    مرداد 1388
    محل زندگی
    تبریز
    پست
    1,078

    نقل قول: جچوری Tilte Bar را راست چین کنم؟

    اول کد جاوای که در بالا دادم رو در اکتیویتی پیست کن
    بعد یک Layout ایجاد کن ( در کدهای جاوا هست action_kala) با نام action_kala که می تونی تغییرش بدی بعد که لایوت رو ساختی در همان اکتیویتی که کد جاوا رو پیست کردی زیر کد
    setContentView(R.layout.(*));

    بنویس
    ActionBar();


    همین

  7. #7

    نقل قول: جچوری Tilte Bar را راست چین کنم؟

    نقل قول نوشته شده توسط saeed_g21 مشاهده تاپیک
    اول کد جاوای که در بالا دادم رو در اکتیویتی پیست کن
    بعد یک Layout ایجاد کن ( در کدهای جاوا هست action_kala) با نام action_kala که می تونی تغییرش بدی بعد که لایوت رو ساختی در همان اکتیویتی که کد جاوا رو پیست کردی زیر کد
    setContentView(R.layout.(*));

    بنویس
    ActionBar();


    همین
    یه بار از اول کلی میگی من نفهمیدم. باید یه class جدید بسازم و اینا رو بزارم بعد واسه اکتیویتی خودم باید چیکار کنم؟

  8. #8
    کاربر دائمی آواتار saeed_g21
    تاریخ عضویت
    مرداد 1388
    محل زندگی
    تبریز
    پست
    1,078

    نقل قول: جچوری Tilte Bar را راست چین کنم؟

    ببینید این شخصی سازی اکشن بار هست که توسط یک لایوت که به عنوان اکشن بار طراحی شده و داخلش از یک ImageView و TextView استفاده شده که میتونی مواردی اضافه یا حذف نمایید

    قبل از هر کاری
    1- یک لایوت جدید بساز و کد لایوت رو داخلش پیست کن و با هرنامی که خواستی ذخیره کن

    2- کد جاوا رو در هر اکتیویتی که خواستی اکشن بارش شخصی سازی باشه در متد onCreate زیر setContentView کپی کن اگه اکتیویتی هات زیاد باشه فکر کنم بتونی برای کدهای اکشن بار یک Class از نوع Static بسازی و در بگیه اکتیویتی هات استفاده نمایید

    نام فایل لایوت ی که برای اکشن بار ساختی رو در کد جاوا در خط View mCustomView = mInflater.inflate(R.layout.action_kala, null); بجای action_kala قرار بده

    کار تمام شد



    کدهای جاوا :
    	    		   	 ActionBar mActionBar = getActionBar();	    		     mActionBar.setDisplayShowHomeEnabled(false);
    mActionBar.setDisplayShowTitleEnabled(false);
    LayoutInflater mInflater = LayoutInflater.from(this);
    View mCustomView = mInflater.inflate(R.layout.action_kala, null);
    TextView mTitleTextView = (TextView) mCustomView.findViewById(R.id.title_text);
    mTitleTextView.setText(getString(R.string.app_name ));
    ImageButton imageButton = (ImageButton) mCustomView.findViewById(R.id.imageButton);
    mActionBar.setCustomView(mCustomView);
    mActionBar.setDisplayShowCustomEnabled(true);
    imageButton.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View arg0) {
    Intent intent = new Intent(catalog.this,filterprudoct.class);
    startActivity(intent);
    }
    });



    کد لایوت:
    <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="50dp" >

    <ImageButton
    android:id="@+id/imageButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:layout_marginRight="8dp"
    android:background="@null"
    android:src="@android:drawable/ic_menu_gallery" />



    <TextView
    android:id="@+id/title_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="10dp"
    android:textAllCaps="true"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="#fff"
    android:textStyle="bold" />

    </RelativeLayout>

  9. #9

    نقل قول: جچوری Tilte Bar را راست چین کنم؟

    نقل قول نوشته شده توسط saeed_g21 مشاهده تاپیک
    ببینید این شخصی سازی اکشن بار هست که توسط یک لایوت که به عنوان اکشن بار طراحی شده و داخلش از یک ImageView و TextView استفاده شده که میتونی مواردی اضافه یا حذف نمایید

    قبل از هر کاری
    1- یک لایوت جدید بساز و کد لایوت رو داخلش پیست کن و با هرنامی که خواستی ذخیره کن

    2- کد جاوا رو در هر اکتیویتی که خواستی اکشن بارش شخصی سازی باشه در متد onCreate زیر setContentView کپی کن اگه اکتیویتی هات زیاد باشه فکر کنم بتونی برای کدهای اکشن بار یک Class از نوع Static بسازی و در بگیه اکتیویتی هات استفاده نمایید

    نام فایل لایوت ی که برای اکشن بار ساختی رو در کد جاوا در خط View mCustomView = mInflater.inflate(R.layout.action_kala, null); بجای action_kala قرار بده

    کار تمام شد



    کدهای جاوا :
                            ActionBar mActionBar = getActionBar();                     mActionBar.setDisplayShowHomeEnabled(false);
    mActionBar.setDisplayShowTitleEnabled(false);
    LayoutInflater mInflater = LayoutInflater.from(this);
    View mCustomView = mInflater.inflate(R.layout.action_kala, null);
    TextView mTitleTextView = (TextView) mCustomView.findViewById(R.id.title_text);
    mTitleTextView.setText(getString(R.string.app_name ));
    ImageButton imageButton = (ImageButton) mCustomView.findViewById(R.id.imageButton);
    mActionBar.setCustomView(mCustomView);
    mActionBar.setDisplayShowCustomEnabled(true);
    imageButton.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View arg0) {
    Intent intent = new Intent(catalog.this,filterprudoct.class);
    startActivity(intent);
    }
    });



    کد لایوت:
    <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="50dp" >

    <ImageButton
    android:id="@+id/imageButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:layout_marginRight="8dp"
    android:background="@null"
    android:src="@android:drawable/ic_menu_gallery" />



    <TextView
    android:id="@+id/title_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="10dp"
    android:textAllCaps="true"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="#fff"
    android:textStyle="bold" />

    </RelativeLayout>
    حل شد. واقعا مرسی

تاپیک های مشابه

  1. چطور اجزا swing رو راست چین کنم؟
    نوشته شده توسط ali zi zeperto در بخش برنامه‌نویسی جاوا
    پاسخ: 1
    آخرین پست: یک شنبه 14 آذر 1389, 17:33 عصر
  2. مشکل راست چین در VFP 7
    نوشته شده توسط Mohammad_Mnt در بخش Foxpro
    پاسخ: 13
    آخرین پست: جمعه 21 بهمن 1384, 13:03 عصر
  3. راست چین کردن ListBox
    نوشته شده توسط Mohammad_Mnt در بخش Foxpro
    پاسخ: 7
    آخرین پست: سه شنبه 27 مرداد 1383, 00:33 صبح
  4. راست چین کردن Edit در windows غیر فارسی
    نوشته شده توسط SReza1 در بخش برنامه نویسی در Delphi
    پاسخ: 2
    آخرین پست: چهارشنبه 19 فروردین 1383, 19:57 عصر

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •