img_shadow.Initialize("") img_shadow.Bitmap=LoadBitmap(File.DirAssets,"shadow.png") img_shadow.Gravity=Gravity.FILL Dim ph As Phone If ph.SdkVersion>=19 Then Dim uper As Panel uper.Initialize("") uper.Color=Colors.RGB(38,69,149) Activity.AddView(uper,0dip,0dip,100%x,24dip) pnl_title.Top=24dip End If Activity.AddView(img_shadow,0dip,pnl_title.Top+pnl_title.Height,100%x,12dip) Activity.AddView(pnl_main,0dip,pnl_title.Top+pnl_title.Height,100%x,100%y-pnl_title.Height+pnl_title.Top)
Dim btn_back As Button btn_back.Initialize("btn_back") btn_back.SetBackgroundImage(LoadBitmapSample(File.DirAssets,"back2.png",24dip,24dip)) pnl_title.AddView(btn_back,12dip,12dip,24dip,24dip)
Dim lbl_title As Label lbl_title.Initialize("") lbl_title.Text=EsmeDastan lbl_title.Typeface=Typeface.LoadFromAssets("airaniansans.ttf") pnl_title.AddView(lbl_title,0,0dip,100%x,48dip) lbl_title.Gravity=Gravity.CENTER lbl_title.TextColor=Colors.White
cur1=M1.sql1.ExecQuery("SELECT * FROM Table1 WHERE onvan='"& EsmeDastan &"'") cur1.Position=0 Log(EsmeDastan) lblMatn.Initialize("") lblMatn.Text=cur1.GetString("matn") lblMatn.TextColor=Colors.Black lblMatn.Typeface=Typeface.LoadFromAssets("airaniansans.ttf") lblMatn.Gravity=Gravity.CENTER lblMatn.Color=Colors.White Dim sc_matn As ScrollView sc_matn.Initialize2(pnl_main.Height,"sc_matn") sc_matn.Panel.AddView(lblMatn,0dip,0dip,100%x,pnl_main.Height) sc_matn.Panel.Height=LH pnl_main.AddView(sc_matn,0dip,0dip,100%x,pnl_main.Height) p0.Initialize("gmd_favorite_outline") p1.Initialize("gmd_favorite") p2.Initialize("gmd_share") p0.actionBarSize p1.actionBarSize p2.actionBarSize p0.Color=Colors.White p1.Color=Colors.White p2.Color=Colors.White
If cur1.GetString("favorite")=0 Then ' img_fav.Background=p0.Drawable img_fav.Bitmap=LoadBitmapSample(File.DirAssets,"state0.png",24dip,24dip)
Else img_fav.Bitmap=LoadBitmapSample(File.DirAssets,"state1.png",24dip,24dip) ' img_fav.Background=p1.Drawable End If img_share.Initialize("img_share") img_share.Gravity=Gravity.FILL img_share.Background=p2.Drawable
pnl_title.AddView(img_fav,100%x-36dip,12dip,24dip,24dip) pnl_title.AddView(img_share,100%x-36dip-48dip,12dip,24dip,24dip) 'pnl_title.AddView(img_fav,100%x-36dip,12dip,24dip,24dip) End Sub
Sub LH As Float 'تابع تنظیم ارتفاع لیبل ها' Dim before,after As Float Dim obj1 As Reflector Dim Lineheight As Int Lineheight =str.MeasureMultilineTextHeight(lblMatn , lblMatn.Text) obj1.Target = lblMatn before = obj1.RunMethod("getLineHeight") 'Get the height of line BEFORE you change it obj1.Target = lblMatn obj1.RunMethod3("setLineSpacing", .10, "java.lang.float", 1.7, "java.lang.float") 'Change the space between lines obj1.Target = lblMatn after = obj1.RunMethod("getLineHeight") 'Get the height of line AFTER you change it Lineheight = ((after * Lineheight)/before) lblMatn.Height = Lineheight Return Lineheight
سوال
msms 2
با سلام
مشکل من تو تنظیم ارتفاع لیبل هستش کسی می تونه کمکم کنه؟
متن کامل نشان داده نمیشه
اسکرول میشه ولی کل متن دیده نمیشه ناقص نشون میده
اینم کدهای منه
Sub style
pnl_title.Initialize("")
pnl_main.Initialize("")
pnl_main.Color=Colors.RGB(237,237,237)
Activity.AddView(pnl_title,0dip,0dip,100%x,48dip)
img_shadow.Initialize("")
img_shadow.Bitmap=LoadBitmap(File.DirAssets,"shadow.png")
img_shadow.Gravity=Gravity.FILL
Dim ph As Phone
If ph.SdkVersion>=19 Then
Dim uper As Panel
uper.Initialize("")
uper.Color=Colors.RGB(38,69,149)
Activity.AddView(uper,0dip,0dip,100%x,24dip)
pnl_title.Top=24dip
End If
Activity.AddView(img_shadow,0dip,pnl_title.Top+pnl_title.Height,100%x,12dip)
Activity.AddView(pnl_main,0dip,pnl_title.Top+pnl_title.Height,100%x,100%y-pnl_title.Height+pnl_title.Top)
Dim btn_back As Button
btn_back.Initialize("btn_back")
btn_back.SetBackgroundImage(LoadBitmapSample(File.DirAssets,"back2.png",24dip,24dip))
pnl_title.AddView(btn_back,12dip,12dip,24dip,24dip)
Dim lbl_title As Label
lbl_title.Initialize("")
lbl_title.Text=EsmeDastan
lbl_title.Typeface=Typeface.LoadFromAssets("airaniansans.ttf")
pnl_title.AddView(lbl_title,0,0dip,100%x,48dip)
lbl_title.Gravity=Gravity.CENTER
lbl_title.TextColor=Colors.White
cur1=M1.sql1.ExecQuery("SELECT * FROM Table1 WHERE onvan='"& EsmeDastan &"'")
cur1.Position=0
Log(EsmeDastan)
lblMatn.Initialize("")
lblMatn.Text=cur1.GetString("matn")
lblMatn.TextColor=Colors.Black
lblMatn.Typeface=Typeface.LoadFromAssets("airaniansans.ttf")
lblMatn.Gravity=Gravity.CENTER
lblMatn.Color=Colors.White
Dim sc_matn As ScrollView
sc_matn.Initialize2(pnl_main.Height,"sc_matn")
sc_matn.Panel.AddView(lblMatn,0dip,0dip,100%x,pnl_main.Height)
sc_matn.Panel.Height=LH
pnl_main.AddView(sc_matn,0dip,0dip,100%x,pnl_main.Height)
p0.Initialize("gmd_favorite_outline")
p1.Initialize("gmd_favorite")
p2.Initialize("gmd_share")
p0.actionBarSize
p1.actionBarSize
p2.actionBarSize
p0.Color=Colors.White
p1.Color=Colors.White
p2.Color=Colors.White
img_fav.Initialize("img_fav")
img_fav.Gravity=Gravity.FILL
If cur1.GetString("favorite")=0 Then
' img_fav.Background=p0.Drawable
img_fav.Bitmap=LoadBitmapSample(File.DirAssets,"state0.png",24dip,24dip)
Else
img_fav.Bitmap=LoadBitmapSample(File.DirAssets,"state1.png",24dip,24dip)
' img_fav.Background=p1.Drawable
End If
img_share.Initialize("img_share")
img_share.Gravity=Gravity.FILL
img_share.Background=p2.Drawable
img_setting.Initialize("")
img_setting.Gravity=Gravity.FILL
' img_setting.Bitmap=LoadBitmapSample(File.DirAssets,"setting.jpg",24dip,24dip)
pnl_title.AddView(img_fav,100%x-36dip,12dip,24dip,24dip)
pnl_title.AddView(img_share,100%x-36dip-48dip,12dip,24dip,24dip)
'pnl_title.AddView(img_fav,100%x-36dip,12dip,24dip,24dip)
End Sub
Sub LH As Float 'تابع تنظیم ارتفاع لیبل ها'
Dim before,after As Float
Dim obj1 As Reflector
Dim Lineheight As Int
Lineheight =str.MeasureMultilineTextHeight(lblMatn , lblMatn.Text)
obj1.Target = lblMatn
before = obj1.RunMethod("getLineHeight") 'Get the height of line BEFORE you change it
obj1.Target = lblMatn
obj1.RunMethod3("setLineSpacing", .10, "java.lang.float", 1.7, "java.lang.float") 'Change the space between lines
obj1.Target = lblMatn
after = obj1.RunMethod("getLineHeight") 'Get the height of line AFTER you change it
Lineheight = ((after * Lineheight)/before)
lblMatn.Height = Lineheight
Return Lineheight
End Sub
لینک ارسال
به اشتراک گذاری در سایت های دیگر
1 پاسخ به این سوال تاکنون داده شده است
ارسالهای توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.