2012-07-21 11 views
5

Necesito saber el código que me permite establecer el peso de una vista remota.Android ¿Cómo configurar el peso de una vista remota?

he intentado con este código, pero esto no funciona:

RemoteViews remoteViews = new RemoteViews(c.getPackageName(), R.layout.notification); 
remoteViews.setInt(R.id.ll_notification, "setWeight", 12); 

Hay una manera de hacer esto? Muchas gracias ....

Respuesta

0

Creo que RemoteView no tiene una propiedad de peso.

No estoy seguro de que vaya a funcionar, pero pruébalo.

RemoteViews remoteViews = new RemoteViews("", 0); 

    LinearLayout.LayoutParams tempLayoutParams =new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); 
    tempLayoutParams.weight = 1.0f; 

    LinearLayout tempLinearLayout = new LinearLayout(getContext()): 
    tempLinearLayout.setLayoutParams(tempLayoutParams); 

    tempLinearLayout.addView(remoteViews); 

Buena suerte.

Cuestiones relacionadas