Android 시작 페이지 화이트 스크린 솔 루 션
처음에 나의 생각 은 이 랬 다.메 인 활동 논리 가 너무 많아 서 그런 지 로 딩 이 느 려 져 서 화면 이 흰색 으로 표 시 됩 니 다.로 컬 그림 만 표시 하 는 활동 을 사용 하면 흰색 화면 이 표시 되 지 않 을 까?말 이 많 지 않 으 니 우리 한번 해 보 자.
Activity 의 코드:
/**
* , logo, 2
*/
public class LunchActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lunch);
// 。 , , sleep
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
start();
LunchActivity.this.finish();
}
}).start();
}
//
private void start(){
Intent intent = new Intent(LunchActivity.this,MainActivity.class);
startActivity(intent);
}
}
layot 의 코드:
<?xml version="1.0" encoding="utf-8"?>
<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"
android:background="#e74b37"
tools:context=".LunchActivity">
<ImageView
android:id="@+id/imageView5"
android:layout_width="80dp"
android:layout_height="80dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.31"
app:srcCompat="@drawable/icon" />
</android.support.constraint.ConstraintLayout>
그림 을 표시 하기 위해 이미지 뷰 를 간단하게 지정 합 니 다.배경 을 주황색 으로 설정 합 니 다.마지막 으로 시작 페이지 활동 을 주 활동 으로 설정 합 니 다:
<activity android:name="com.example.qinglv.LunchActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
모든 것 을 잘 생각 하고 있 습 니 다.완성 한 후에 열 어 보 세 요.아니면 흰색 화면 이 나 옵 니까?어떻게 된 일 입 니까?활동 의 로 딩 은 모두 시간 이 필요 합 니 다.비교적 간단 한 활동 시간 은 적 지만 한 순간의 흰색 화면 이 있 습 니 다.그럼 이 흰색 화면 은 도대체 뭐 예요?모든 활동 의 배경 이다.이 벤트 를 열 때 내용 을 불 러 오지 않 았 기 때문에 배경 만 표 시 됩 니 다.이 배경 을 바 꾸 고 우리 가 필요 로 하 는 로고 사진 으로 설정 하면 됩 니 다.어떻게 설정 하지?
4.567917.배경 은 주제 에서 지정 한 것 입 니 다.먼저 주 제 를 설정 하고 배경 을 우리 가 원 하 는 것 으로 바 꿉 니 다.일반적으로 우리 의 시작 페이지 와 일치 합 니 다.그러면 두 개의 시작 페이지 처럼 보이 지 않 습 니 다.왕 이 클 라 우 드 음악 처럼 배경 을 로고 로 설정 할 수도 있 지만 시작 페이지 는 광 고 를 내 는 것 이지 만 사용자 체험 에 영향 을 줄 수 있다(수입 을 위해 광 고 를 하 는 것 도 이해 할 수 있다).코드 보기:res-value-styles 에서:
<style name="NewAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="android:windowBackground">@color/colorPrimary</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
포 인 트 는 이 문장 입 니 다<item name="android:windowBackground">@color/colorPrimary</item>
여 기 는 제 가 지정 한 색깔 입 니 다.여러분 도 한 장의 그림 을 지정 할 수 있 습 니 다.시작 페이지 이벤트 에 테 마 를 지정 합 니 다재:Android Manifest:
<activity android:name="com.example.qinglv.LunchActivity"
android:theme="@style/NewAppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
포 인 트 는 이 문장 입 니 다android:theme="@style/NewAppTheme"
그리고 다시 열 면 안 된다 는 걸 알 게 될 거 야.원래 표 시 된 흰색 화면 이 우리 가 설정 한 그림 으로 바 뀌 었 다.이상 은 안 드 로 이 드 시작 페이지 백 스크린 솔 루 션 의 상세 한 내용 입 니 다.안 드 로 이 드 시작 페이지 백 스크린 에 관 한 자 료 는 다른 관련 글 을 주목 하 세 요!
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Bitrise에서 배포 어플리케이션 설정 테스트하기이 글은 Bitrise 광고 달력의 23일째 글입니다. 자체 또는 당사 등에서 Bitrise 구축 서비스를 사용합니다. 그나저나 며칠 전 Bitrise User Group Meetup #3에서 아래 슬라이드를 발표했...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.