2012-07-21 10 views
5

Ho bisogno di conoscere il codice che mi permette di impostare il peso di un RemoteView.Android Come impostare Peso di un RemoteView?

ho provato con questo codice, ma questo non funziona:

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

C'è un modo per fare questo? Molte grazie ....

risposta

0

Penso che RemoteView non abbia una proprietà di peso.

Non sono sicuro che funzionerà, ma provatelo.

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); 

Buona fortuna.

Problemi correlati