我正在使用带有3个选项卡的TabLayout.我自定义了我的标签视图,因此,我需要在我的标签下删除以下行(截图不是来自我的应用):
我没有使用TabHost或TabWidget,因此我无法使用setStripEnabled(false)
.将背景设置为透明也不会改变任何东西.
这是我的xml:
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:padding="4dip"
android:layout_above="@+id/bottomcontent3"
android:gravity="center_horizontal"
android:background="@android:color/white"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.TabLayout
android:id="@+id/comtabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:tabPaddingStart="0dp"
app:tabPaddingEnd="0dp"
app:tabMode="fixed"
app:tabGravity="fill"
android:background="@android:color/white" />
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/compager"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v4.view.ViewPager>
</android.support.design.widget.AppBarLayout>
Run Code Online (Sandbox Code Playgroud)
我找到的所有答案都在使用TabHost
,TabWidget
.就我而言,我正在使用一个TabLayout
和三个Tab
.在这种情况下如何删除此行?非常感谢.
编辑由于某些原因,我的代码无法解析TabLayout中的某些方法.有我使用的java代码:
TabLayout tabLayout = (TabLayout) view.findViewById(R.id.comtabs);
tabLayout.setTabMode(TabLayout.MODE_FIXED);
// add tabs
tabLayout.addTab(tabLayout.newTab());
tabLayout.addTab(tabLayout.newTab());
tabLayout.addTab(tabLayout.newTab());
RelativeLayout layout1 = (RelativeLayout) inflater.inflate(R.layout.communitytablayoutleft, container, false);
RelativeLayout layout2 = (RelativeLayout) inflater.inflate(R.layout.communitytablayout, container, false);
RelativeLayout layout3 = (RelativeLayout) inflater.inflate(R.layout.communitytablayoutright, container, false);
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用MPAndroidChart在我的应用程序中创建一个图表.
但具有一些特定功能.
chart.getLayoutParams().width=100*entries.size();
最后,当触摸其中一个栏时,不选择下方的栏(如果有办法可以阻止用户滚动!).
MPAndroidChart在技术上是否可行?提前致谢.
我想知道,从Locale,我是否必须使用24或12格式.
我找到了这个:
if (android.text.format.DateFormat.is24HourFormat(getApplicationContext()))
Run Code Online (Sandbox Code Playgroud)
但是这会根据系统返回一个布尔值,而不是Locale.这意味着如果用户使用英语为应用程序但使用24小时格式的手机,它将返回true ...
我如何得到一个布尔告诉我使用的格式是否是24小时?我不是在使用Joda.提前致谢.
编辑似乎有些人认为这是重复的,我已经阅读了你提供的帖子作为重复标志的来源.它只能通过近似的变通方法或提供日期的方法来解决,大部分时间都是当前的,即使它是相应的格式.
你可以猜到,如果我想要一种方法来知道我是否应该根据Locale使用12小时格式,这意味着我不需要日期或任何东西,我已经拥有,但是确认我必须使用的格式.
我正在尝试使用 mailchimp API 3.0、Meteor 和 javascript 更新我的订阅者之一的状态。
这是我正在使用的js代码:
request({
uri,
list_id,
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'Authorization': 'apikey (my api key)'
},
json,
}, function(err, res, body) {
if (err) {
return console.log("err:", err);
}
console.log("connection succeed");
console.log("res: ", res.body);
console.log("body: ", body);
});
Run Code Online (Sandbox Code Playgroud)
和
uri = "https://us15.api.mailchimp.com/3.0/lists/" + (id of my list) + "/members/" + (md5 of my user mail);
Run Code Online (Sandbox Code Playgroud)
和
json = {
"email_address": (user mail as a string),
"status": "unsubscribed"
};
Run Code Online (Sandbox Code Playgroud)
但我总是有相同的输出:
I20181204-18:42:12.714(8)?标题:“成员存在”,I20181204-18:42:12.714(8)?状态:400,I20181204-18:42:12.714(8)?详细信息:'(用户邮件地址)已经是列表成员。使用 PUT 插入或更新列表成员。
但我已经在使用 …
我HttpsConnection
在Android上遇到了麻烦.
首先,不,它不是重复.我在SO上尝试了几乎所有的解决方案,比如更改keep-alive
选项或者timeout
(其中一些确实优化了我的代码的一部分)但是它在Android上比在iOS上慢5到10倍(可能更多).
在Android上发送请求到我的服务器需要几秒钟,而在iOS和浏览器上它几乎是即时的.我确信服务器没有原因.但似乎获得输入流非常慢!
这一行:
in=conn.getInputStream();
Run Code Online (Sandbox Code Playgroud)
是最拖延的,它本身需要几秒钟.
我的目标是从我的服务器获取JSON.我的代码应该在技术上尽可能地优化(并且它可能可以帮助一些人HttpsConnection
在同一时间):
protected String getContentUrl(String apiURL)
{
StringBuilder builder = new StringBuilder();
String line=null;
String result="";
HttpsURLConnection conn= null;
InputStream in= null;
try {
URL url;
// get URL content
url = new URL(apiURL);
System.setProperty("http.keepAlive", "false");
trustAllHosts();
conn = (HttpsURLConnection) url.openConnection();
conn.setHostnameVerifier(DO_NOT_VERIFY);
conn.setRequestMethod("GET");
conn.setRequestProperty(MainActivity.API_TOKEN, MainActivity.ENCRYPTED_TOKEN);
conn.setRequestProperty("Connection", "close");
conn.setConnectTimeout(1000);
in=conn.getInputStream();
// open the stream and put it into BufferedReader
BufferedReader br = new BufferedReader(new InputStreamReader(in));
while ((line=br.readLine())!= …
Run Code Online (Sandbox Code Playgroud)