我在相对布局中有一个RatingBar:
一切都好,灰色和金色的星星。 https://www.dropbox.com/s/22y8117fwyv969x/Stars23.JPG?dl=0
但是如果我在ListView中有相同的RatingBar,结果是:
有什么问题?我该如何解决?有什么想法吗?
代码:
<RatingBar
android:id="@+id/ratings_list_item_ratingBar"
style="@style/Widget.AppCompat.RatingBar.Small"
android:theme="@style/RatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:isIndicator="true"
android:numStars="5"
android:stepSize="1"/>
styles.xml中的样式:
<style name="RatingBar" parent="Theme.AppCompat">
<item name="colorControlNormal">@android:color/darker_gray</item>
<item name="colorControlActivated">@color/Yelow200</item>
</style>
适配器:
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater
.inflate(R.layout.ratings_list_item, parent, false);
RatingBar ratingBar = (RatingBar) rowView.findViewById(R.id.ratings_list_item_ratingBar);
float ratingNumber = (float)values.get(position).getRating();
ratingBar.setRating(ratingNumber);
return rowView;
}
答案 0 :(得分:0)
您正在使用的var listOfDirectReportsNames = // Get the list of all the directreports user names and store in list- List<string>();
var pc = new System.DirectoryServices.AccountManagement.PrincipalContext(System.DirectoryServices.AccountManagement.ContextType.Domain, Environment.UserDomainName);
foreach (string name in listOfDirectReportsNames)
{
var up = new System.DirectoryServices.AccountManagement.UserPrincipal(pc);
up.Name = name; //to test this, pass the exact LDAP Name/DisplayName/GivenName of any user
System.DirectoryServices.AccountManagement.PrincipalSearcher searcher = new System.DirectoryServices.AccountManagement.PrincipalSearcher(up);
var res = searcher.FindOne();
string empID = ((System.DirectoryServices.AccountManagement.UserPrincipal)res).EmployeeId;//here you will get employee ID
up.Dispose();
}
可能没有注意到您的应用程序的style.xml。
使用以下LayoutInflater尝试(抱歉,以前无法测试此方法,但在类似情况下有所帮助):
LayoutInflater