主にRPA、Androidアプリ開発について投稿しています。メモ書きです。
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
// LoginActivity呼び出し
Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
// LoginActivity起動
startActivity(intent);
// SplashActivity終了
SplashActivity.this.finish();
}
}, 3 * 1000); // 3000ミリ秒後(3秒後)に実行
}
<?xml version="1.0" encoding="utf-8"?>・・・省略・・・
<FrameLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android" >
<FrameLayout2つ目のFrameLayoutは、ドラッグ可能な範囲。
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_gravity="center_vertical|right"
android:id="@+id/keyContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</FrameLayout>
</FrameLayout>
</FrameLayout>
public static void setTenkey(View v){
if (bundle == null) {
activity.getSupportFragmentManager().beginTransaction()
.add(R.id.keyContainer, new TenkeyFragment())
.commit();
}
FrameLayout fl = findViewById(R.id.keyContainer);
DragViewListener dvListener = new DragViewListener(fl);
fl.setOnTouchListener(dvListener);
<EditText
android:focusable="false"
android:padding="10px"
android:gravity="center_vertical|right"
android:id="@+id/tvQuantity"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingRight="10px"
android:text="10"
android:textSize="30px"
android:inputType="number"
android:textColor="#222222"
/>
<LinearLayoutただし、こちらでもEditTextの値編集ができなくなる。
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
android:descendantFocusability="blocksDescendants"
>
<activity
android:name=".MainActivity"
android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
EditText.OnFocusChangeListener OnFocusChange = new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
InputMethodManager imm = (InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
EditText et = (EditText)v;
et.setTextIsSelectable(true);
}
}
};
final HorizontalScrollView hsvTest = findViewById(R.id.hsvTest);
hsvTest.post(new Runnable() {
@Override
public void run() {
hsvTest.fullScroll(HorizontalScrollView.FOCUS_RIGHT);
}
});
<LinearLayout色の設定はお好みで。
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="2px"
>
<TextView
android:layout_width="2px"
android:layout_height="match_parent"
/>
@Override
public int getItemViewType(int position) {
//最初のデータ or データ数が1以下
if(position == 0 || items.size() <= 1){
return 0;
}
GenbaData prevData = items.get(position - 1);
GenbaData data = items.get(position);
//現場の比較
if(!prevData.getGenbaName().equals(data.getGenbaName())){
return 0;
}
//品目の比較
if(!prevData.getHinmoku().equals(data.getHinmoku())){
return 1;
}else{
return 2;
}
}
@Override
public int getViewTypeCount() {
return 3;//Viewのタイプ数
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View view;
switch (getItemViewType(position)){
case 0:
if(convertView == null){
convertView = inflater.inflate(R.layout.input_list_item_01,parent,false);
}
break;
case 1:
if(convertView == null){
convertView = inflater.inflate(R.layout.input_list_item_02,parent,false);
}
break;
case 2:
if(convertView == null){
convertView = inflater.inflate(R.layout.input_list_item_03,parent,false);
}
break;
default:
//ありえない
}
tv.setTextColor(this.getContext().getColor(R.color.colorExcelLine));
tv.setTextColor(Color.rgb(0, 0, 0));
tv.setBackgroundColor(Color.parseColor("#000000"));
GradientDrawable gd = new GradientDrawable();
gd.setColor(context.getColor(R.color.colorTkmtGreen));
convertView.setForeground(gd);
//これもできる↓
GradientDrawable gd = new GradientDrawable();
gd.setColor(Color.rgb(0,0,0));
v.setForeground(gd);