主にRPA、Androidアプリ開発について投稿しています。メモ書きです。
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
long lon = calendarView.getDate();値の変更に関しては、CalendarView.OnDateChangeListenerにて取得することもできる。
Calendar a = Calendar.getInstance();
a.setTimeInMillis(lon);
Date aa = a.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
Toast.makeText(this,sdf.format(aa),Toast.LENGTH_SHORT).show();
<RadioButtondrawableとcolorの設定は、xmlを分けなければならないようだ。
android:id="@+id/rdoAll"
android:gravity="center"
android:text="すべて"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="match_parent"
android:button="@null"
android:textColor="@drawable/tab_selector_text_01"
android:background="@drawable/tab_selector_01"
android:checked="true"
/>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_checked="true"
android:drawable="@drawable/simple_frame_tkmt_b"
>
</item>
<item
android:state_checked="false"
android:drawable="@drawable/simple_frame"
>
</item>
</selector>
<?xml version="1.0" encoding="utf-8"?>★注意するのは、文字色用のセレクターでtextColorとして設定しても反映されない。
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_checked="true"
android:color="#FFFFFF"
>
</item>
<item
android:state_checked="false"
android:color="#000000"
>
</item>
</selector>
bundle.putSerializable("TYPE",type);
DialogUtil.dialogtype type = (DialogUtil.dialogtype)getArguments().get("TYPE");
CustomDialogFragment cdf = new CustomDialogFragment();CustomDialogFragment.java
Bundle bundle = new Bundle();
bundle.putString("TITLE",title);
bundle.putString("MESSAGE",message);
bundle.putSerializable("TYPE",type);
cdf.setArguments(bundle);
cdf.show(activity.getSupportFragmentManager(),null);
@NonNullタイプによってレイアウトを使い分け。DialogUtil.dialogtypeはenum。
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
//タイトル
String title = getArguments().getString("TITLE");
//メッセージ
String message = getArguments().getString("MESSAGE");
DialogUtil.dialogtype type = (DialogUtil.dialogtype)getArguments().get("TYPE");
if(title.equals("") || message.equals("") || type == null){
dismiss();
}
int layoutID;
switch (type){
case OK_ONLY:
layoutID = R.layout.dialog_ok_only;
break;
case OK_CANCEL:
layoutID = R.layout.dialog_ok_cancel;
break;
case YES_NO:
layoutID = R.layout.dialog_ok_only;
break;
default:
layoutID = R.layout.dialog_ok_only;
break;
}
View view = getActivity().getLayoutInflater().inflate(layoutID,null);
TextView tvTitle = view.findViewById(R.id.tvTitle);
tvTitle.setText(title);
TextView tvMessage = view.findViewById(R.id.tvMessage);
tvMessage.setText(message);
//ポジティブボタン
TextView tvPositive = view.findViewById(R.id.btnPositive);
tvPositive.setOnClickListener(OnClickPositive);
//ネガティブボタン
TextView tvNegative = view.findViewById(R.id.btnNegative);
tvNegative.setOnClickListener(OnClickNegative);
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="1dp" android:color="#FFFFFF"/>
<!-- 背景色 -->
<solid android:color="@color/Excel_green"/>
<!-- 角丸 -->
<corners android:radius="4dp"/>
</shape>
Animation ani = AnimationUtils.loadAnimation(context, R.anim.load_text);
tvSiteName.startAnimation(ani);
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="8000"
android:fromXDelta="100%p"
android:repeatCount="1"
android:repeatMode="restart"
android:toXDelta="-100%p" />
</set>