我在做什么:我正在创建一个自定义警报对话框
我想做什么:以及下面的代码,如何更改对话框中的操作按钮的颜色(正面和负面)
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Get the layout inflater
LayoutInflater inflater = getActivity().getLayoutInflater();
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
builder.setView(inflater.inflate(R.layout.dialog_signin, null))
// Add action buttons
.setPositiveButton(R.string.signin, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
// sign in the user ...
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface …Run Code Online (Sandbox Code Playgroud) Filters.java
public class Filters extends Activity implements OnSeekBarChangeListener{
private SeekBar PRICEbar,DISTANCEbar, RATINGbar; // declare seekbar object variable
// declare text label objects
private TextView PRICEtextProgress,DISTANCEtextProgress, RATINGtextProgress;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// load the layout
setContentView(R.layout.filters);
PRICEbar = (SeekBar)findViewById(R.id.PRICEseekBarID); // make seekbar object
PRICEbar.setOnSeekBarChangeListener(this);
PRICEbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method …Run Code Online (Sandbox Code Playgroud) activity_second.xml
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="temp"
type="com.vogella.android.databinding.TemperatureData" />
<variable
name="presenter"
type="com.vogella.android.databinding.MainActivityPresenter"/>
</data>
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</layout>
Run Code Online (Sandbox Code Playgroud)
rowlayout.xml
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="obj"
type="com.vogella.android.databinding.TemperatureData"
/>
</data>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip"
>
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_marginRight="6dip"
android:contentDescription="TODO"
android:src="@drawable/ic_listentry"
/>
<TextView
android:id="@+id/secondLine"
android:layout_width="fill_parent"
android:layout_height="26dip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/icon"
android:ellipsize="marquee"
android:text="@{obj.location}"
android:textSize="12sp"
android:maxLines="1"
/>
<TextView
android:id="@+id/firstLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/secondLine"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_toRightOf="@id/icon"
android:gravity="center_vertical"
android:text="@{obj.celsius}"
android:textSize="16sp"
/>
</RelativeLayout>
</layout>
Run Code Online (Sandbox Code Playgroud)
MyAdapter.java
public class …Run Code Online (Sandbox Code Playgroud) 一些依赖性没有得到解决,
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.ui.PlacePicker;
Run Code Online (Sandbox Code Playgroud)
private void setDefaultFont() {
try {
final Typeface bold = Typeface.createFromAsset(getAssets(), "fonts/OpenSans-Bold.ttf");
final Typeface italic = Typeface.createFromAsset(getAssets(), "fonts/OpenSans-Italic.ttf");
final Typeface boldItalic = Typeface.createFromAsset(getAssets(), "fonts/OpenSans-BoldItalic.ttf");
final Typeface regular = Typeface.createFromAsset(getAssets(),"fonts/OpenSans-Regular.ttf");
Field DEFAULT = Typeface.class.getDeclaredField("DEFAULT");
DEFAULT.setAccessible(true);
DEFAULT.set(null, regular);
Field DEFAULT_BOLD = Typeface.class.getDeclaredField("DEFAULT_BOLD");
DEFAULT_BOLD.setAccessible(true);
DEFAULT_BOLD.set(null, bold);
Field sDefaults = Typeface.class.getDeclaredField("sDefaults");
sDefaults.setAccessible(true);
sDefaults.set(null, new Typeface[]{
regular, bold, italic, boldItalic
});
} catch (NoSuchFieldException e) {
// logFontError(e);
} catch (IllegalAccessException e) {
// logFontError(e);
} catch (Throwable e) { …Run Code Online (Sandbox Code Playgroud) 我已经编辑了文件 main.dart
主镖
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(home: Text('Hello World')));
Run Code Online (Sandbox Code Playgroud)
现在我得到了错误:
pubspec.yaml
name: flutter_app
description: A new Flutter application.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In …Run Code Online (Sandbox Code Playgroud) 我尝试了什么 ::
JSON响应POJO我需要更多信息 ::
Robospice,它看起来像周围的任何包装Spring或Retrofit或AsyncHttp等Spring或Retrofit或AsyncHttp等Spring或Retrofit或AsyncHttp等作为样板代码,使开发更容易如果我不对,请提供明确的信息
我是android的新手,请轻松回答问题
注意 ::我已经查看了CommonsWare 在这里回答的答案,但在调试工具中并不是很清楚
Android Studio是否提供不在eclipse中的特殊调试功能?
如果是这样的话是什么?
我在做什么 ::
MainActivity.java
package com.example.butterknife;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import butterknife.ButterKnife;
import butterknife.InjectView;
public class MainActivity extends Activity {
@InjectView(R.id.txtID) TextView title;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.inject(this);
title.setText("Hello Everyone !!");
}
}
Run Code Online (Sandbox Code Playgroud)
记录 ::
04-15 11:50:57.845: E/AndroidRuntime(913): FATAL EXCEPTION: main
04-15 11:50:57.845: E/AndroidRuntime(913): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.butterknife/com.example.butterknife.MainActivity}: java.lang.NullPointerException
04-15 11:50:57.845: E/AndroidRuntime(913): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
04-15 11:50:57.845: E/AndroidRuntime(913): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
04-15 11:50:57.845: E/AndroidRuntime(913): at android.app.ActivityThread.access$600(ActivityThread.java:122)
04-15 11:50:57.845: E/AndroidRuntime(913): …Run Code Online (Sandbox Code Playgroud) 玩家视图
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/exoplayerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:controller_layout_id="@layout/layout_exoplayer_control_views"
app:use_controller="true">
Run Code Online (Sandbox Code Playgroud)
样式化的播放器视图
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/exoplayerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:controller_layout_id="@layout/layout_exoplayer_control_views"
app:use_controller="true">
Run Code Online (Sandbox Code Playgroud)
app:controller_layout_id,为什么会有两种不同类型的播放器