我zooming="true"
在标签内添加了但是当页面加载时我无法缩放以增加或减少视图.我还设置webkitallowfullscreen mozallowfullscreen allowfullscreen
缩放页面以适应设备屏幕但没有任何改变,页面仍然被剪切.
为了更好地解释这个概念,我采用Android
原生应用程序.现在,如果您想从Web加载页面,则使用a WebView
,结果就像使用iframe
on一样Ionic
.但在Android上,事情变得更简单:
webview.getSettings().setBuiltInZoomControls(true);
Run Code Online (Sandbox Code Playgroud)
启用捏合缩放,和
webview.getSettings().setUseWideViewPort(true);
Run Code Online (Sandbox Code Playgroud)
根据(移动)屏幕的大小来适应和缩放网页.现在,使用Windows 10
它我不可能建立native iOS apps
所以我必须依靠cross-platform development
.
这里是我的detail-page
:
html
:
<ion-content>
<iframe sandbox class="link" frameborder="0" [src]="webPage()" zooming="true" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</ion-content>
Run Code Online (Sandbox Code Playgroud)
scss
:
detail-page {
.scroll-content{
padding: 0px ;
}
::-webkit-scrollbar,
*::-webkit-scrollbar {
display: none;
}
iframe.link {
width: 100%;
height: 100%;
max-width: 100%;
max-height: 100%;
}
}
Run Code Online (Sandbox Code Playgroud)
ts
:
webPage() {
return this.sanitizer.bypassSecurityTrustResourceUrl(this.entry.getElementsByTagName('link')[0].textContent);
} …
Run Code Online (Sandbox Code Playgroud) 我有一个CustomListView
地方,我正在显示一些文本,并image
使用Picasso
的库显示.我在xml
drawable文件夹中创建了一个文件,并为drawable-21文件夹创建了一个文件,Ripple Effect
但由于某种原因,效果不会超过ImageView
.
这是我的文件:
drawable
:
listview_item_background.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid
android:color="#ffdadada"/>
</shape>
</item>
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid
android:color="#ffffff"/>
</shape>
</item>
</selector>
Run Code Online (Sandbox Code Playgroud)
drawable-v21
:
listview_item_background.xml
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#ffdadada">
<item android:drawable="@android:color/white"/>
</ripple>
Run Code Online (Sandbox Code Playgroud)
activity_main
:
<?xml version="1.0"?>
<android.support.design.widget.CoordinatorLayout
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"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="150dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:expandedTitleMarginStart="20dp"
app:expandedTitleMarginEnd="20dp"
app:contentScrim="@color/colorPrimary"
android:background="@color/colorPrimary"> …
Run Code Online (Sandbox Code Playgroud) 我有一个活动与Navigation Drawer
使用ScrimInsetsFrameLayout
我能够将布局放在下面StatusBar
,一切都很完美.然后,我决定更换颜色的Toolbar
,并StatusBar
与png
所有的活动布局的背景.我在模拟器上运行应用程序(带有android 6.0的Nexus 5),结果正是我想要的,你可以在下面的图像#1中看到,但当我尝试使用我的设备(带有android 5.0的Galaxy Note 3)时,里面的布局ScrimInsetsFrameLayout超越了StatusBar
Image#2.我无法理解什么是错的,你能帮助我吗?
这是我values-v21
和我的activity.xml
<style parent="Theme.AppCompat.Light.NoActionBar" name="AppTheme_Activities">
<item name="android:colorPrimary">@android:color/transparent</item>
<item name="android:colorPrimaryDark">@color/insetF</item>
<item name="android:navigationBarColor">@color/insetF</item>
<item name="android:colorAccent">@color/primary</item>
<item name="android:colorEdgeEffect">@color/primary</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:statusBarColor">@color/insetF</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
<?xml version="1.0"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/drawer"
android:fitsSystemWindows="true"
android:background="@drawable/background"> <!--png image-->
<FrameLayout
android:orientation="vertical"
android:layout_height="match_parent"
android:layout_width="match_parent">
<include layout="@layout/toolbar_activities" android:id="@+id/toolbar_layout"/>
<FrameLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/content_frame">
</FrameLayout>
</FrameLayout>
<com.example.myapplication.ScrimInsetsFrameLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/linearLayout"
android:layout_width="304dp"
android:layout_height="match_parent" …
Run Code Online (Sandbox Code Playgroud) 我想做一个SettingsActivity
让用户个性化应用外观的应用程序。在此活动中,用户可以选择将应用程序保持在“ 浅色主题 ”(例如,带有黑色文本的白色背景)或“ 深色主题 ”,浅色主题的相反颜色有利于夜间使用。
怎么做?
我正在考虑为每个主题在xml中创建不同的布局。
编辑
下图是的示例SettingsActivity
,我想更改整个应用的外观,而不是单个活动的外观。
我想Sound Level Pressure
表达自己的意思,decibel
但我总是这样0
。(的输出TextView
为-Infinity,但因为log(0)= -infinity。
public class SLP extends Activity{
TextView sound;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sound_activity);
MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
Timer timer = new Timer();
timer.scheduleAtFixedRate(new RecorderTask(recorder), 0, 500);
}
private class RecorderTask extends TimerTask {
TextView sound = (TextView) findViewById(R.id.decibel);
private MediaRecorder recorder;
public RecorderTask(MediaRecorder recorder) {
this.recorder = recorder;
}
public void run() {
runOnUiThread(new Runnable() {
@Override
public …
Run Code Online (Sandbox Code Playgroud)