موقعی که روی گوشی برنامه را اجرا میکنم وقتی روی لیست ویو کلیک میکنم که بره به قسمت مطالب این ارورا میده
اینم سورس قسمت مطلبم هست
#Region Activity Attributes
#FullScreen: true
#IncludeTitle: false
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim label1 As Label
Private ScrollView1 As ScrollView
Dim i1 As PhoneIntents
Dim intent1 As Intent
Dim list1 As List
Private Button1 As Button
Private Button2 As Button
Private Button12 As Button
Private Button11 As Button
Private Button5 As Button
Private Button4 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("layout2")
If File.Exists(File.DirInternal,"bargh.db")=False Then
File.Copy(File.DirAssets,"bargh.db",File.DirInternal,"bargh.db")
End If
If main2.sql1.IsInitialized=False Then
main2.sql1.Initialize(File.DirInternal,"bargh.db",False)
End If
Dim cur As Cursor
cur=main2.sql1.ExecQuery("SELECT * FROM bargh1 WHERE id="&main2.fasl)
cur.Position=0
If cur.GetInt("fav")=0 Then
Dim Ba As BitmapDrawable
Ba.Initialize(LoadBitmap(File.DirAssets,"fav.png"))
Button2.Background=Ba
Else
Dim Ba As BitmapDrawable
Ba.Initialize(LoadBitmap(File.DirAssets,"fav2.png"))
Button2.Background=Ba
End If
Dim h As Int
For i = 0 To 13
If cur.GetString("matn"&i) <> Null Then
label1.Initialize("Label1")
label1.Text=cur.GetString("matn"&i)
label1.TextColor=Colors.White
label1.TextSize=20
label1.Gravity=Gravity.RIGHT
ScrollView1.Panel.AddView(label1,0,h+2%y,ScrollView1.Width-10,ScrollView1.Height)
Dim su As StringUtils
label1.Height=su.MeasureMultilineTextHeight(label1,label1.Text)+10
h=h+su.MeasureMultilineTextHeight(label1,label1.Text)+30
ScrollView1.Panel.Height=h
End If
If cur.GetString("aks"&i) <> Null Then
Dim ImageView1 As ImageView
ImageView1.Initialize("imageview")
ImageView1.Tag=cur.GetString("aks"&i)
ScrollView1.Panel.AddView(ImageView1,0,h,ScrollView1.Width,ScrollView1.Height)
ImageView1.Bitmap=Main.bitmap1(i)
If Main.bitmap1(i).width > 100%x Then
ImageView1.Width=100%x
ImageView1.Height=(ImageView1.Width/Main.bitmap1(i).width)*Main.bitmap1(i).Height
ImageView1.Gravity=Gravity.FILL
Else
ImageView1.Width=Main.bitmap1(i).Width
ImageView1.Height=Main.bitmap1(i).Height
ImageView1.Left=(100%x-ImageView1.Width)/2
ImageView1.Gravity=Gravity.FILL
End If
h=h+ImageView1.Height+30
ScrollView1.Panel.Height=h
End If
Next
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
StartActivity(main2)
Activity.Finish
End Sub
Sub Button2_Click
Dim cur As Cursor
cur=main2.sql1.ExecQuery("SELECT * FROM bargh1 WHERE id="&main2.fasl)
For i=0 To cur.rowcount-1
cur.position=i
Dim f As Int
f = cur.GetInt("fav")
If f = 1 Then
main2.SQL1.ExecNonQuery("UPDATE bargh1 SET fav = 0 WHERE id = "&cur.GetInt("id"))
Dim bb As BitmapDrawable
bb.Initialize(LoadBitmap(File.DirAssets,"fav.png"))
Button2.Background=bb
ToastMessageShow("از لیست علاقه مندی ها حذف شد",False)
Else
main2.SQL1.ExecNonQuery("UPDATE bargh1 SET fav = 1 WHERE id = "&cur.GetInt("id"))
Dim bb As BitmapDrawable
bb.Initialize(LoadBitmap(File.DirAssets,"fav2.png"))
Button2.Background=bb
ToastMessageShow("به لیست علاقه مندی ها اضافه شد",False)
End If
Next
cur.close
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_BACK Then
StartActivity(main2)
End If
End Sub
سوال
hossein44 1
یه برنامه درست کردم که عکس و متن باهمه
موقعی که روی گوشی برنامه را اجرا میکنم وقتی روی لیست ویو کلیک میکنم که بره به قسمت مطالب این ارورا میده
اینم سورس قسمت مطلبم هست
#Region Activity Attributes #FullScreen: true #IncludeTitle: false #End Region Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. End Sub Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Dim label1 As Label Private ScrollView1 As ScrollView Dim i1 As PhoneIntents Dim intent1 As Intent Dim list1 As List Private Button1 As Button Private Button2 As Button Private Button12 As Button Private Button11 As Button Private Button5 As Button Private Button4 As Button End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: Activity.LoadLayout("layout2") If File.Exists(File.DirInternal,"bargh.db")=False Then File.Copy(File.DirAssets,"bargh.db",File.DirInternal,"bargh.db") End If If main2.sql1.IsInitialized=False Then main2.sql1.Initialize(File.DirInternal,"bargh.db",False) End If Dim cur As Cursor cur=main2.sql1.ExecQuery("SELECT * FROM bargh1 WHERE id="&main2.fasl) cur.Position=0 If cur.GetInt("fav")=0 Then Dim Ba As BitmapDrawable Ba.Initialize(LoadBitmap(File.DirAssets,"fav.png")) Button2.Background=Ba Else Dim Ba As BitmapDrawable Ba.Initialize(LoadBitmap(File.DirAssets,"fav2.png")) Button2.Background=Ba End If Dim h As Int For i = 0 To 13 If cur.GetString("matn"&i) <> Null Then label1.Initialize("Label1") label1.Text=cur.GetString("matn"&i) label1.TextColor=Colors.White label1.TextSize=20 label1.Gravity=Gravity.RIGHT ScrollView1.Panel.AddView(label1,0,h+2%y,ScrollView1.Width-10,ScrollView1.Height) Dim su As StringUtils label1.Height=su.MeasureMultilineTextHeight(label1,label1.Text)+10 h=h+su.MeasureMultilineTextHeight(label1,label1.Text)+30 ScrollView1.Panel.Height=h End If If cur.GetString("aks"&i) <> Null Then Dim ImageView1 As ImageView ImageView1.Initialize("imageview") ImageView1.Tag=cur.GetString("aks"&i) ScrollView1.Panel.AddView(ImageView1,0,h,ScrollView1.Width,ScrollView1.Height) ImageView1.Bitmap=Main.bitmap1(i) If Main.bitmap1(i).width > 100%x Then ImageView1.Width=100%x ImageView1.Height=(ImageView1.Width/Main.bitmap1(i).width)*Main.bitmap1(i).Height ImageView1.Gravity=Gravity.FILL Else ImageView1.Width=Main.bitmap1(i).Width ImageView1.Height=Main.bitmap1(i).Height ImageView1.Left=(100%x-ImageView1.Width)/2 ImageView1.Gravity=Gravity.FILL End If h=h+ImageView1.Height+30 ScrollView1.Panel.Height=h End If Next End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub Sub Button1_Click StartActivity(main2) Activity.Finish End Sub Sub Button2_Click Dim cur As Cursor cur=main2.sql1.ExecQuery("SELECT * FROM bargh1 WHERE id="&main2.fasl) For i=0 To cur.rowcount-1 cur.position=i Dim f As Int f = cur.GetInt("fav") If f = 1 Then main2.SQL1.ExecNonQuery("UPDATE bargh1 SET fav = 0 WHERE id = "&cur.GetInt("id")) Dim bb As BitmapDrawable bb.Initialize(LoadBitmap(File.DirAssets,"fav.png")) Button2.Background=bb ToastMessageShow("از لیست علاقه مندی ها حذف شد",False) Else main2.SQL1.ExecNonQuery("UPDATE bargh1 SET fav = 1 WHERE id = "&cur.GetInt("id")) Dim bb As BitmapDrawable bb.Initialize(LoadBitmap(File.DirAssets,"fav2.png")) Button2.Background=bb ToastMessageShow("به لیست علاقه مندی ها اضافه شد",False) End If Next cur.close End Sub Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event If KeyCode = KeyCodes.KEYCODE_BACK Then StartActivity(main2) End If End Subکسی میدونه مشکل از چیه؟
لینک ارسال
به اشتراک گذاری در سایت های دیگر
5 پاسخ به این سوال تاکنون داده شده است
ارسالهای توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.