こまごま備忘録
自分の場合、なので他の機種でもそうなのか分からん。
フルスクリーンにする
AndroidMnifest.xml
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
onCreate内
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
2つ追加した。人によって違いすぎて、何が正しいのか分からん。自分の場合は、これでできた。
参考
https://jirosoft.com/wordpress/android-memo/memo001/
http://pentan.info/android/app/status_bar_hidden.html
https://akira-watson.com/android/theme-notitlebar.html
https://qiita.com/furu8ma/items/4328c793250b10313cd7
https://qiita.com/Mocacamo/items/9849d5590d2109eaf4b8
アプリの背景に画像を設定
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="centerCrop"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/bg_snow_diamond_dust"
tools:layout_editor_absoluteX="0dp" />
レイアウト内にImageViewを入れてandroid:scaleType=”centerCrop”を設定する。これもIDEさんに怒られてるので正しいのかわからない。
参考
http://hakoniwadesign.com/?p=5890
ImgButtonの背景を透過する
android:background="@null"
参考
https://gendosu.jp/archives/670
android:onClickでエラー
Method has incorrect signature less… (Ctrl+F1)
Checks if the method specified in onClick XML attribute is declared in related activity
というエラーがxmlで出た。typoが原因かなと思ったけどそうじゃなく、Activity内の当該メソッドに
public void onClick(View v){
Toast.makeText(this,"test",Toast.LENGTH_SHORT).show();
}
View vが入ってなかったのが原因だった。