No topo está rolando na horizontal, mais precisaria de criar um jeito de clicar em cada jogo pra chamar outra tela. Anexei a tela para ficar mais facil o entendimento, e não consegui criar uma text do local do jogo, acima do resultado.
1°) Não estou conseguindo incluir uma textView acima do resultado do jogo 1 x 1 e acima seria Pacaembu como exemplo. Pois precisaria incluir mais um Linear e não sei incluir isso no codigo pela api ai seria 2 lineares correto???
2°) Acima é um campo com rolagem horizontal, ira visualizar os ultimos e proximos jogos, e cada jogo teria que clicar para chamar uma tela de ficha tecnica, e não sei como fazer esse componentes ser clicavel…
Bom, vc tendo sua view (seja ela LinearLayout ou qq outra view), vc tem um método addView(), que vc pode informar qual a posição que ela será inserida.
Sobre o componente ser clicável, acho que depende do componente. Uma olhada na documentação já dá pra saber se ele vai ter o método setOnClickListener().
inclui mais um parametro no meu metodo…(public void loadTopo(List xmlLista, LinearLayout layout, LinearLayout layout2)
e o que vc me falou…
ImageView imgMandante = new ImageView(this);
imgMandante.setImageResource(R.drawable.guarani);
layout.addView(imgMandante);
TextView local = new TextView (this);
local.setGravity(Gravity.CENTER);
local.setTextColor(Color.BLACK);
local.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
local.setText(topo.getLocal());
layout2.addView(local);
TextView resultado = new TextView (this);
resultado.setWidth(150);
//resultado.setHeight(100);
resultado.setGravity(Gravity.CENTER);
resultado.setTextColor(Color.BLACK);
resultado.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
resultado.setText(topo.getJogos());
layout2.addView(resultado);
ImageView imgAdversario = new ImageView(this);
images.setUrlImagem(topo.getStringUrlEscudoAdv());
imgAdversario.setImageBitmap(images.LoadImage(bmOptions));
layout.addView(imgAdversario);
layout.addView(layout2, new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
Seria assim??
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): FATAL EXCEPTION: main
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.logicadigital.activity/br.com.logicadigital.activity.ListaActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at android.os.Handler.dispatchMessage(Handler.java:99)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at android.os.Looper.loop(Looper.java:123)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at java.lang.reflect.Method.invokeNative(Native Method)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at java.lang.reflect.Method.invoke(Method.java:507)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at dalvik.system.NativeStart.main(Native Method)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at android.view.ViewGroup.addViewInner(ViewGroup.java:1976)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at android.view.ViewGroup.addView(ViewGroup.java:1871)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at android.view.ViewGroup.addView(ViewGroup.java:1851)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at br.com.logicadigital.activity.ListaActivity.loadTopo(ListaActivity.java:153)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at br.com.logicadigital.activity.ListaActivity.onCreate(ListaActivity.java:105)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-02 16:38:41.814: ERROR/AndroidRuntime(6238): ... 11 more