我是Android應用程序開發新手,正在研究各種視圖。有這引起了我的注意,並在谷歌用來播放音樂Android應用查看以在Android應用程序中顯示第三方許可證
我認爲這是一個PopUpWindow但不完全確定的特定視圖。我們如何實現這種視圖並自定義其中的文本?
我是Android應用程序開發新手,正在研究各種視圖。有這引起了我的注意,並在谷歌用來播放音樂Android應用查看以在Android應用程序中顯示第三方許可證
我認爲這是一個PopUpWindow但不完全確定的特定視圖。我們如何實現這種視圖並自定義其中的文本?
它的自定義對話框我的朋友 遵循以下步驟將箱子您的自定義dailog
第1步: - >創建資源佈局文件custom_layout /佈局文件夾這樣
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp"
android:text="hello world" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp"
android:text="hello world" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp"
android:text="hello world" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@mipmap/ic_launcher" />
step「: - > 2在你的活動中創建一個像這樣的撥號java文件
Dialog custoDialog = new Dialog(MainActivity.this);
custoDialog.setContentView(R.layout.custom_layout);
Window window = custoDialog.getWindow();
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
window.setGravity(Gravity.CENTER);
// acces you custom dialog controlss like this
TextView tv = (TextView) custoDialog.findViewById(R.id.tv);
tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//perfom actions here
}
});
custoDialog.show();
問我任何查詢
你提的問題是非常含糊的情況。顯示許可證的實際視圖,通常是一個名爲Dialog的Android視圖,還有一個第三方庫,通過對話框簡化了工作:Material Dialogs。 關於許可證,有一個很好的庫,用於檢索項目中使用的庫的相關信息:3rd party licenses
thanks!這是我一直在尋找的! – Noob
@Noob最歡迎欣賞編碼 –