我需要在xml本身中将text ="font roboto regular"更改为Font Roboto Regular,该怎么办?
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="18sp"
android:textColor="@android:color/black"
android:fontFamily="roboto-regular"
android:text="font roboto regular"
android:inputType="textCapWords"
android:capitalize="words"/>
Run Code Online (Sandbox Code Playgroud) 我面临单个 API 重复请求的问题,我使用的是改造 2.当我尝试调用一个 API 时,它命中服务器的次数是 3 倍。相同的 API 被多次调用,但只有一小部分。这是代码:
public Retrofit retrofit() {
String UrlBasePath="";
if (mRetrofit == null) {
if (builder == null) {
builder = new OkHttpClient.Builder();
builder.addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request original = chain.request();
HttpUrl httpUrl = original.url().newBuilder()
.build();
String credentials = BuildConfig.ApiUserName + ":" + BuildConfig.ApiPassword;
if (BuildConfig.ApiUserName.equals("APIUSERNAME") || BuildConfig.ApiPassword.equals("APIPASSWORD")) {
AnalyticsManager.sendEvent("RETROERROR", "AUTHENTICATIONFAILED", "FAILED");
}
final String basic = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP);
// Request customization: add …Run Code Online (Sandbox Code Playgroud) 我在扩展搜索栏时尝试更改搜索视图的下划线颜色
SearchView.SearchAutoComplete autoCompleteTextView = (SearchView.SearchAutoComplete) searchView.findViewById(R.id.search_src_text);
autoCompleteTextView.setCursorVisible(true);
autoCompleteTextView.setTextColor(ContextCompat.getColor(this, R.color.textcolor_light_gray));
autoCompleteTextView.setHintTextColor(autoCompleteTextView.getTextColors().withAlpha(255));
autoCompleteTextView.setTextSize(16);
View searchplate = (View)searchView.findViewById(android.support.v7.appcompat.R.id.search_plate);
searchplate.setBackgroundResource(R.drawable.autocomplete_bg);
Run Code Online (Sandbox Code Playgroud)
在这里我用主题来改变颜色
<style name="MySearchViewStyle" parent="Widget.AppCompat.Light.SearchView">
<!-- Background for the search query section (e.g. EditText) -->
<item name="queryBackground">@color/darkgray</item>
</style>
Run Code Online (Sandbox Code Playgroud)
但没有什么对我有用.任何人帮我...