erfane 1 ارسال شده در ۵ مرداد ۱۳۹۲ گزارش اشتراک گذاری ارسال شده در ۵ مرداد ۱۳۹۲ سلام دوستان.کد زیر رو برای فارسی کردن اکسپندر نوشتم اما درست کار نمی کنه و هم چنین نمی دونم از (setIndicatorBounds(int left, int right چه طوری استفاده کنم که راست چین بشه.ممنون می شم راهنمایی کنید. کلاس MyAdeptor.java package com.Main;import com.Main.PersianReshape;import android.content.Context;import android.graphics.Color;import android.graphics.Typeface;import android.view.View;import android.view.ViewGroup;import android.widget.BaseExpandableListAdapter;import android.widget.TextView;public class MyAdapter extends BaseExpandableListAdapter {private Context context;Typeface ty;String []parentlist={"نمره","مستمر"}; String [][]chid={{"بیست"},{"بیست"}};public MyAdapter(Context context) { // TODO Auto-generated constructor stub this.context=context;}@Overridepublic Object getChild(int groupPosition, int childPosition) { // TODO Auto-generated method stub return null;}@Overridepublic long getChildId(int groupPosition, int childPosition) { // TODO Auto-generated method stub return 0;}@Overridepublic View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ty=Typeface.createFromAsset(context.getAssets(), "fonts/Bzar.ttf"); TextView tv=new TextView(context); tv.setText(chid[groupPosition][childPosition]); tv.setPadding(70, 10, 10, 10); tv.setTextSize(25); tv.setTypeface(ty); chid[0][0]=PersianReshape.reshape(chid[0][0].toString()); chid[1][0]=PersianReshape.reshape(chid[1][0].toString()); return tv;}@Overridepublic int getChildrenCount(int groupPosition) { // TODO Auto-generated method stub return chid[groupPosition].length;}@Overridepublic Object getGroup(int groupPosition) { // TODO Auto-generated method stub return groupPosition;}@Overridepublic int getGroupCount() { // TODO Auto-generated method stub return parentlist.length;}@Overridepublic long getGroupId(int groupPosition) { // TODO Auto-generated method stub return groupPosition;}@Overridepublic View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ty=Typeface.createFromAsset(context.getAssets(), "fonts/Bzar.ttf"); TextView tv=new TextView(context); tv.setText(parentlist[groupPosition]); tv.setPadding(60, 10, 10, 10); tv.setTextSize(25); tv.setTextColor(Color.BLUE); tv.setTypeface(ty); //String a="عارفه"; //String b="نرگس"; parentlist[0]=PersianReshape.reshape(parentlist[0].toString()); parentlist[1]=PersianReshape.reshape(parentlist[1].toString()); return tv;}@Overridepublic boolean hasStableIds() { // TODO Auto-generated method stub return false;}@Overridepublic boolean isChildSelectable(int groupPosition, int childPosition) { // TODO Auto-generated method stub return true;}} نقل قول لینک ارسال به اشتراک گذاری در سایت های دیگر
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .