1

リンクで 3 番目の例を実装しようとしています: http://devblog.blackberry.com/2009/10/how-to-use-table-view-layout/

レイアウトを試すために簡単なアプリを作成しましたが、アイテムが画面いっぱいに表示されず、画面の左側にとどまります。サンプルリンクでスクリーンショットを正確に表示したい。ただし、私のアプリは次のようになります。

ここに画像の説明を入力

スクリーンショットで指摘したように、右側にinnerTableアイテムが必要です。

ここに私のコードがあります:

TableLayoutManager outerTable = new TableLayoutManager(new int[]{
        TableLayoutManager.USE_PREFERRED_SIZE,
        TableLayoutManager.SPLIT_REMAINING_WIDTH
       },USE_ALL_WIDTH);

TableLayoutManager innerTable = new TableLayoutManager(new int[]{
                TableLayoutManager.USE_PREFERRED_SIZE,
                TableLayoutManager.USE_PREFERRED_SIZE
               },TableLayoutManager.USE_ALL_WIDTH);
TableLayoutManager innerTable2 = new TableLayoutManager(new int[]{
                TableLayoutManager.USE_PREFERRED_SIZE,
                TableLayoutManager.USE_PREFERRED_SIZE
               },0);


innerTable.add(new LabelField("titleField"));
innerTable.add(new LabelField("title"));
innerTable.add(new LabelField("descriptionfield"));
innerTable.add(new LabelField("description"));
innerTable.add(new LabelField("rating field"));
innerTable.add(new LabelField("***"));
outerTable.add(new BitmapField(Bitmap.getBitmapResource("testimg.png"),Field.FOCUSABLE));
outerTable.add(innerTable);


innerTable2.add(new LabelField("titleField"));
innerTable2.add(new LabelField("title"));
innerTable2.add(new LabelField("descriptionfield"));
innerTable2.add(new LabelField("description"));
innerTable2.add(new LabelField("rating field"));
innerTable2.add(new LabelField("***"));
outerTable.add(new BitmapField(Bitmap.getBitmapResource("testimg.png"),Field.FOCUSABLE));
outerTable.add(innerTable2);
add(outerTable);

何か考えはありますか?ありがとう

4

1 に答える 1

2

各フィールド アラインメント フラグで遊んでみてください。例えば:

innerTable2.add(new LabelField("titleField", DrawStyle.RIGHT | Field.USE_ALL_WIDTH));
于 2013-04-02T13:21:00.630 に答える