بروز خطا
[message]
اشتراک در سوال
رای ها
[dataList]
اینکلود کردن یه لایه دیگه در لایه دلخواهمون
سلام.
اینکلود کردن یه لایه دیگه در لایه دلخواهمون چجوریه؟
من اینکاری کردم اما جاب نداد.
String str = G.selectedApplication.post_dl;
str = str.replace("$", "");
str = str.replace("*", "@@");
String[] Links = str.split(",");
int numberlinkdl = Links.length;
for (int i = 0; i < numberlinkdl; i++) {
String[] LinkDeatails = Links[i].split(":");
String[] FormatAndSinger = LinkDeatails[0].split("@@");
String Format = FormatAndSinger[1];
String Singer = FormatAndSinger[0];
String UrrDl = LinkDeatails[1] + LinkDeatails[2];
Log.i("LOG", "UrrDl" + i + " is : " + UrrDl);
Log.i("LOG", "Singer" + i + " is : " + Singer);
Log.i("LOG", "Format" + i + " is : " + Format);
/* az Inja be bad */
LayoutInflater inflater = getLayoutInflater();
View view = inflater.inflate(R.layout.trackdeatails, null);
txtFormat = (TextView) view.findViewById(R.id.txtFormat);
txtFormat.setText("test");
package project;
import ir.pjpro.aloonak.music.app.R;
import java.io.File;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
public class ActivityApplicationDetail extends EnhancedActivity {
public TextView txtTitle;
public TextView txtLike;
public TextView txtSinger;
public TextView txtText;
public TextView txtDlmusic;
public ImageView imgLogo;
public TextView txtFormat;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_application_detail);
txtTitle = (TextView) findViewById(R.id.txtTitle);
txtSinger = (TextView) findViewById(R.id.txtSinger);
txtLike = (TextView) findViewById(R.id.txtLike);
txtText = (TextView) findViewById(R.id.txtText);
txtDlmusic = (TextView) findViewById(R.id.txtDllink);
imgLogo = (ImageView) findViewById(R.id.imgPost);
txtTitle.setText(G.selectedApplication.post_title);
txtSinger.setText(G.selectedApplication.post_singer);
txtLike.setText("" + G.selectedApplication.post_like + " Likes");
txtText.setText(G.selectedApplication.post_text);
String str = G.selectedApplication.post_dl;
str = str.replace("$", "");
str = str.replace("*", "@@");
String[] Links = str.split(",");
int numberlinkdl = Links.length;
for (int i = 0; i < numberlinkdl; i++) {
String[] LinkDeatails = Links[i].split(":");
String[] FormatAndSinger = LinkDeatails[0].split("@@");
String Format = FormatAndSinger[1];
String Singer = FormatAndSinger[0];
String UrrDl = LinkDeatails[1] + LinkDeatails[2];
Log.i("LOG", "UrrDl" + i + " is : " + UrrDl);
Log.i("LOG", "Singer" + i + " is : " + Singer);
Log.i("LOG", "Format" + i + " is : " + Format);
/* az Inja be bad */
LayoutInflater inflater = getLayoutInflater();
View view = inflater.inflate(R.layout.trackdeatails, null);
txtFormat = (TextView) view.findViewById(R.id.txtFormat);
txtFormat.setText("test");
}
//txtDlmusic.setText(G.selectedApplication.post_dl);
String filename = HelperString.getFileName(G.selectedApplication.post_picture_large);
final File imageFile = new File(G.DIR_FINAL + "/" + filename);
if ( !imageFile.exists()) {
imgLogo.setImageBitmap(null);
DownloadManager.addToDownloadList(G.selectedApplication.post_picture_large, imgLogo);
}
BitmapFactory.Options options = new BitmapFactory.Options();
//options.inSampleSize = 8;
Bitmap bitmap = BitmapFactory.decodeFile(imageFile.getAbsolutePath(), options);
imgLogo.setImageBitmap(bitmap);
}
}
}
0
0
اگه منظورتون رو درست متوجه شده باشم:
توی فایل xml لایه ای که در برگیرنده لایه های دیگه هست از تگ inclode استفاده کنید و لایه مورد نظر رو inclode کنید. اگه از اندروید استودیو استفاده میکنید پایین تمام آیتمهایی که میتونید به لایه اضافه کنید گزینه inclode وجود داره. (11 سال پیش)
برای این سوال 2 پاسخ وجود دارد.
پاسخ به سوال
سعید
11 سال پیش
+1
0
ببینید من یه سری لینک دانلود دارم که هر کدو رو میخوام توی یک باکس نمایش بدم.
یه حلقه for گذاشتم که هر کدمو که خونده شد این لایه رو اینکلود کنه و نمایش بده.
پاسخ به سوال
سعید
11 سال پیش
+1
0
این تغییرات رو اعمال کردم درست شد.
String str = G.selectedApplication.post_dl;
str = str.replace("$", "");
str = str.replace("*", "@@");
String[] Links = str.split(",");
int numberlinkdl = Links.length;
for (int i = 0; i < numberlinkdl; i++) {
String[] LinkDeatails = Links[i].split(":");
String[] FormatAndSinger = LinkDeatails[0].split("@@");
String Format = FormatAndSinger[1];
String Singer = FormatAndSinger[0];
String UrrDl = LinkDeatails[1] + ":" + LinkDeatails[2];
Log.i("LOG", "UrrDl" + i + " is : " + UrrDl);
Log.i("LOG", "Singer" + i + " is : " + Singer);
Log.i("LOG", "Format" + i + " is : " + Format);
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View TrackView = inflater.inflate(R.layout.trackdeatails, (ViewGroup) findViewById(R.id.toosi), true);
txtNameTrack = (TextView) TrackView.findViewById(R.id.txtNameTrack);
txtNameTrack.setText(" 1." + Singer);
}
پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .