如何向我的微调器添加底部边框,例如Google添加新联系人(参见图片)?
然后,当我点击微调器时,在Google添加新联系人中,边框变为蓝色.
我的微调器有这个代码:
<Spinner
android:id="@+id/spinner1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/insert_type"
android:prompt="@string/insert_type_title"/>
Run Code Online (Sandbox Code Playgroud)
我有一个类似的标签布局,有4个标签.
当我从选项卡0转到选项卡2然后我回到选项卡0时,会重新加载Fragment0 ..当我从选项卡转到另一个"离开"选项卡时出现同样的问题.
我只会第一次加载Fragment并重新使用它们,而不重新加载.
这是我的代码的一部分(我使用本教程):
MyActivity:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.my_activity);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if(getSupportActionBar()!=null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = MyActivity.this.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(ContextCompat.getColor(MyActivity.this, R.color.colorPrimaryDark));
}
viewPager = (ViewPager) findViewById(R.id.viewpager);
setupViewPager(viewPager);
tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setSelectedTabIndicatorColor(Color.parseColor("#FFFFFF"));
tabLayout.setupWithViewPager(viewPager);
setupTabIcons(); //I have only icon, not text.
}
private void setupViewPager(ViewPager viewPager) {
ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
adapter.addFragment(MyFragment.newInstance(0));
adapter.addFragment(MyFragment.newInstance(1));
adapter.addFragment(new DifferentFragment());
adapter.addFragment(new TestFragment()); …Run Code Online (Sandbox Code Playgroud) 我<start-login></start-login>和指令
app.directive('startLogin', function(){
return {
restrict: 'E',
templateUrl: 'startlogin.html',
controller: 'LoginController'
}
});
Run Code Online (Sandbox Code Playgroud)
我需要在检查后执行指令,如下所示:
var checkLogin = false //variable
if(checkLogin){
//do something and DON'T EXECUTE DIRECTIVE
}else{
//EXECUTE DIRECTIVE
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?我的项目中也有jQuery ..
我使用AngularJs,我需要在$ http.post连接后返回一个数据.这是代码:
app.controller('PrincipalController',['$http', '$scope', function($http,$scope){
$scope.myData = 0;
$http.post("server/checklogin.php",
{id: "id",email: "email",password: "password"}
)
.success(function(data){
console.log($scope.myData) //0
$scope.myData = data;
console.log($scope.myData); // 1
}
Run Code Online (Sandbox Code Playgroud)
OLD:如何将数据传递给myData? - 感谢您的回答,对不起,如果我没有解释清楚.
但现在,在HTML中,{{myData}}我能写些什么?
我不知道它是否是基础,但我必须使用"ng-if"来使用"myData".
编辑:谢谢!我想我已经解决了!:d
我有一个ng-repeat和ng-class的问题.我只想在参数"sel"为真时才应用类.我的数据是这样的:
people = [{"id":0,"name":"Simone","sel":true},{"id":1,"name":"Maria","sel":false},{"id":2,"name":"Marco","sel":false}]
在我的html页面中,我:
<li ng-repeat="person in people" id="person-{{person.id}}">
<span ng-class="{person-select: person.sel == 'true'}">{{person.name}}</span>
</li>
Run Code Online (Sandbox Code Playgroud)
但它不起作用..我哪里错了?我试过{{person.name}}-{{person.sel}}并打印出"Simone-true .. Maria-false .. Marco-false".
我想从另一个类型创建一个新类型,用于Pick包含指定的属性。我发现了这个:Typescript:以目标字符串开头时排除属性键
我需要相反的。
起源:
type Origin = {
testA: string,
testB: string,
_c: string,
_d: string,
example: string,
anotherName: string,
}
Run Code Online (Sandbox Code Playgroud)
结果我会:
type Result = {
_c: string,
_d: string
};
Run Code Online (Sandbox Code Playgroud)
我尝试过
type Result = Pick<Origin, `_${string}`>
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
Type '`_${string}`' does not satisfy the constraint 'keyof Origin'
Run Code Online (Sandbox Code Playgroud) 我尝试使用pushNotification注册我的设备,使用演示.它不起作用.打印"Cordova PushNotification插件演示"和"注册android"并查看警报"OK"(successHandler函数有效).问题是"ecb"不起作用.为什么?你能帮助我吗?
我与Cordova一起安装的插件有:PushPlugin,Device,Notification,InAppBrowser和Network Information.
我在我的LG L9和模拟器上试过这个应用程序.同样的问题.
这是代码:
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery_1.5.2.min.js"></script>
<script type="text/javascript" src="PushNotification.js"></script>
<script type="text/javascript">
var pushNotification;
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
function onDeviceReady() {
pushNotification = window.plugins.pushNotification;
if (device.platform == 'android' || device.platform == 'Android') {
$("#app-status-ul").append("<li>registering android</li>");
window.plugins.pushNotification.register(successHandler, errorHandler, {
"senderID": "my_id",
"ecb": "onNotificationGCM"
}); // required!
} else {
$("#app-status-ul").append("<li>registering iOS</li>");
pushNotification.register(tokenHandler, errorHandler, {
"badge": "true",
"sound": "true",
"alert": "true",
"ecb": "onNotificationAPN"
}); // required!
}
}
// handle …Run Code Online (Sandbox Code Playgroud) 如何将带有表情符号的文本从Android应用程序发送到服务器并将其正确保存在MySql数据库中?
在Android应用程序中,我将一些带有post方法的参数传递给php服务器,然后将其保存到MySql数据库中.但是表情符号我有两个问题
Warning: #1366 Incorrect string value: '\xF0\x9F\x98\x8D' for column 'name' at row 1.表和字段具有utf8mb4_bin排序规则.使用Google Drive Rest Api,我尝试使用此功能下载广告图片.
我得到一个包含以下代码的文件列表:
List<String> fileInfo = new ArrayList<>();
FileList result = mService.files().list()
.setPageSize(10)
.setQ("mimeType='image/jpeg'")
.setFields("nextPageToken, files(id, name)")
.execute();
List<File> files = result.getFiles();
if (files != null) {
for (File file : files) {
fileInfo.add(String.format("%s (%s)\n",
file.getName(), file.getId()));
}
}
Run Code Online (Sandbox Code Playgroud)
它有效.然后,使用文件ID,我获得一个带有以下代码的OutputStream:
String fileId = "file_id";
OutputStream fOut = new ByteArrayOutputStream();
mService.files().export(fileId,"image/jpeg").executeMediaAndDownloadTo(fOut);
Run Code Online (Sandbox Code Playgroud)
现在,我如何将其转换为文件然后转换为位图?
android ×4
angularjs ×3
angular-http ×1
bitmap ×1
cordova ×1
emoji ×1
mysql ×1
ng-class ×1
ng-repeat ×1
outputstream ×1
php ×1
spinner ×1
tabs ×1
typescript ×1