2012-07-21 8 views
5

私はRemoteViewのウエイトを設定できるコードを知る必要があります。Android RemoteViewの設定方法は?

私はこのコードを試みたが、これは動作しません:

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

これを行う方法はありますか? 多くのありがとう....

答えて

0

私はRemoteViewは重量プロパティを持っていないと思う。

私はそれがうまくいくとは思っていませんが、試してみてください。

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

幸運。

関連する問題