我將動態添加RatingBar爲線性佈局。評分欄在手機中不可見,因爲它在平板電腦中可見。 以下是創建RatingBar的代碼。動態添加RatingBar不顯示
View newWidget = new RatingBar(appContext);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.gravity = Gravity.CENTER_HORIZONTAL;
newWidget.setLayoutParams(layoutParams);
((RatingBar) newWidget).setStepSize(1.0f);
你還沒有添加布局參數來查看 –
忘了添加那件作品@VivekMishra –