the rating bar inside my dialog box is going out of bounds
final AlertDialog.Builder popDialog = new AlertDialog.Builder(ExercisesActivity.this);
final RatingBar rb = new RatingBar(ExercisesActivity.this);
popDialog.setIcon(android.R.drawable.btn_star_big_on);
rb.setMax(6);
popDialog.setTitle("Set Difficulty");
popDialog.setView(rb);
// Button OK
popDialog.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//do things
}
});
popDialog.create();
popDialog.show();
setMax()
无效
答案 0 :(得分:0)
首先指定高度和宽度:
LinearLayout linearLayout = new LinearLayout(this);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT
);
linearLayout.addView(rb);
设置要显示的星星数setNumStars(x)。为了正确显示这些内容,建议此小部件的布局宽度为自动换行内容。 喜欢:
rb.setNumStars(6);
答案 1 :(得分:0)
您可以这样设置自己的宽度:
rb.getLayoutParams().width = WindowManager.LayoutParams.MATCH_PARENT;
// you can also use WRAP_CONTENT but I think that for your dialog MATCH_PARENT is better
答案 2 :(得分:0)
setMax()方法定义了用户可以选择的最大启动次数。
根据您的查询,我希望您正在设置要显示的星星数。
因此在您的代码中删除
<properties>
<java.version>1.8</java.version>
<spring-boot-admin.version>2.1.4</spring-boot-admin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-dependencies</artifactId>
<version>${spring-boot-admin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
并用
替换$("#campiagn_search_id").keyup(function(){alert($(this).val());});
希望四给你一个解决方案:)
答案 3 :(得分:0)